Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 30 → Rev 31

/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 ; <Space> = Shuffle
je SHUF
cmp eax,13 ; <Enter> = 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:
/programs/15/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm 15.asm 15
@pause
/programs/15/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm 15.asm 15
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
/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
 
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/3dcube2/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm 3dcube2.asm 3dcube2
@pause
/programs/3dcube2/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm 3dcube2.asm 3dcube2
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
/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:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/3detx60b/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm 3detx60b.asm 3detx60b
@pause
/programs/3detx60b/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm 3detx60b.asm 3detx60b
@pause
/programs/3detx60b/trunk/map.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/3detx60b/trunk/texmap.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/3detx60b/trunk/texpack.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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:
/programs/3dtcub10/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm 3dtcub10.asm 3dtcub10
@pause
/programs/3dtcub10/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm 3dtcub10.asm 3dtcub10
@pause
/programs/3dtcub10/trunk/texture.raw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ac97wav/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm ac97wav.asm ac97wav
@pause
/programs/ac97wav/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ac97wav.asm ac97wav
@pause
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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'
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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.
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/aclock/trunk/aclock.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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: ;;
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/airc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm airc.asm airc
@pause
/programs/airc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm airc.asm airc
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/arcanii/trunk/arcanii.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
}
;---------------------------------------
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/arcanii/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm arcanii.asm arcanii
@pause
/programs/arcanii/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm arcanii.asm arcanii
@pause
/programs/arcanoid/trunk/ARC.BMP
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/arcanoid/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm arcanoid.asm arcanoid
@pause
/programs/arcanoid/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm arcanoid.asm arcanoid
@pause
/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 <meos,win>
error "Please specify SYS: meos OR win"
end if
 
 
/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
 
„® ­®¢ëå ¢áâà¥ç!
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/archer/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm @rcher.asm @rcher
@pause
/programs/archer/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm @rcher.asm @rcher
@pause
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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'
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/arpstat/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm arpstat.asm arpstat
@pause
/programs/arpstat/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm arpstat.asm arpstat
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bcdclk/bcdclk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm bcdclk.asm bcdclk
@pause
/programs/bcdclk/bcdclk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm bcdclk.asm bcdclk
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bgitest/trunk/FONTS/EURO.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/GOTH.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/LCOM.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/LITT.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SANS.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SCRI.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SIMP.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/SMAL.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/TRIP.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/bgitest/trunk/FONTS/TSCR.CHR
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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 ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bgitest/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm bgitest.asm bgitest
@pause
/programs/bgitest/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm bgitest.asm bgitest
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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.
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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. „®¡ ¢¨âì ä㭪樨 ¢ë¢®¤  ç¨á¥«.
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/bmpview/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm bmpview.asm bmpview
@pause
/programs/bmpview/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm bmpview.asm bmpview
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/board/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm board.asm board
@pause
/programs/board/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm board.asm board
@pause
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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)
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/c4/trunk/blue.pcx
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/c4/trunk/red.pcx
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/calc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm calc.asm calc
@pause
/programs/calc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm calc.asm calc
@pause
/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:
 
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/calendar/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm calendar.asm calendar
@pause
/programs/calendar/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm calendar.asm calendar
@pause
/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 ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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. ˆá¯à ¢¨âì ¡ £¨, ª®â®àë¥, ¢®§¬®¦­®, ­ ©¤ãâáï ;-)
 
â㠯ணࠬ¬ã ï ¯®á¢ïé î ãªà ¨­áª®© ¯®¬ à ­ç¥¢®© ॢ®«î樨.
 
 §®¬ ­ á ¡ £ â®, ­ á ­¥ ¯®¤®« â¨!
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/cdp/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cdp.asm cdp
@pause
/programs/cdp/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cdp.asm cdp
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/cdplay/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cdplay.asm cdplay
@pause
/programs/cdplay/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cdplay.asm cdplay
@pause
/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:
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/chess/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm chess.asm chess
@pause
/programs/chess/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm chess.asm chess
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/circle/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm circle.asm circle
@pause
/programs/circle/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm circle.asm circle
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/cmd/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cmd.asm cmd
@pause
/programs/cmd/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cmd.asm cmd
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/colorref/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm colorref.asm colorref
@pause
/programs/colorref/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm colorref.asm colorref
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/colors/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm colors.asm colors
@pause
/programs/colors/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm colors.asm colors
@pause
/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 ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/copy2/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm copy2.asm copy2
@pause
/programs/copy2/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm copy2.asm copy2
@pause
/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 <pointer;length>
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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/copyr/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm copyr.asm copyr
@pause
/programs/copyr/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm copyr.asm copyr
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/cpu/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cpu.asm cpu
@pause
/programs/cpu/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cpu.asm cpu
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/cpuid/no.sources
--- cpuspeed/trunk/build_en.bat (nonexistent)
+++ cpuspeed/trunk/build_en.bat (revision 31)
@@ -0,0 +1,4 @@
+@erase lang.inc
+@echo lang fix en >lang.inc
+@fasm cpuspeed.asm cpuspeed
+@pause
\ No newline at end of file
/programs/cpuspeed/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cpuspeed.asm cpuspeed
@pause
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/crownscr/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm crownscr.asm crownscr
@pause
/programs/crownscr/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm crownscr.asm crownscr
@pause
/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 (?)
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/cslide/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cslide.asm cslide
@pause
/programs/cslide/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cslide.asm cslide
@pause
/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:
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/desktop/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm desktop.asm desktop
@pause
/programs/desktop/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm desktop.asm desktop
@pause
/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 ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/dhcp/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm dhcp.asm dhcp
@pause
/programs/dhcp/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm dhcp.asm dhcp
@pause
/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:
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/dnsr/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm dnsr.asm dnsr
@pause
/programs/dnsr/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm dnsr.asm dnsr
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/end/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm end.asm end
@pause
/programs/end/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm end.asm end
@pause
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ethstat/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm ethstat.asm ethstat
@pause
/programs/ethstat/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ethstat.asm ethstat
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/example/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm example.asm example
@pause
/programs/example/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm example.asm example
@pause
/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: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/example2/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm example2.asm example2
@pause
/programs/example2/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm example2.asm example2
@pause
/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:
 
 
 
 
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/example3/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm example3.asm example3
@pause
/programs/example3/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm example3.asm example3
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/eyes/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm eyes.asm eyes
@pause
/programs/eyes/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm eyes.asm eyes
@pause
/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"
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/eyes/trunk/eyes.raw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/fasm/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm fasm.asm fasm
@pause
/programs/fasm/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm fasm.asm fasm
@pause
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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,<val> \}
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
macro db [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,db,<val> \}
macro dw [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dw,<val> \}
macro du [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,du,<val> \}
macro dd [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dd,<val> \}
macro dp [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dp,<val> \}
macro dq [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dq,<val> \}
macro dt [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dt,<val> \}
macro rb count \{ \local anonymous
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
macro rw count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
macro rd count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
macro rp count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
macro rq count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
macro rt count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \}
virtual at 0 }
 
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
fields@\\#name equ fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
 
macro make@struct name,[field,type,def]
{ common
if $
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
err
end if
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
 
macro define@struct name,[field,type,def]
{ common
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label .
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common \\\} \\} \} }
 
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,name,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
 
enable@substruct
 
macro define@union parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
virtual at 0
parent#field type def
sizeof.#parent#field = $ - parent#field
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 \} }
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 }
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/fire/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm fire.asm fire
@pause
/programs/fire/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm fire.asm fire
@pause
/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:
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/fire2/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm fire2.asm fire2
@pause
/programs/fire2/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm fire2.asm fire2
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/free3d04/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm free3d04.asm free3d04
@pause
/programs/free3d04/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm free3d04.asm free3d04
@pause
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
 
--------------------------------------------
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/gifview/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm gifview.asm gifview
@pause
/programs/gifview/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm gifview.asm gifview
@pause
/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'
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <MENUETOS,OTHER>)
; 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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/grscreen/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm grscreen.asm grscreen
@pause
/programs/grscreen/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm grscreen.asm grscreen
@pause
/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/h2d2b/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm h2d2b.asm h2d2b
@pause
/programs/h2d2b/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm h2d2b.asm h2d2b
@pause
/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: ; ìåòêà êîíöà ïðîãðàììû
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/heed/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm heed.asm heed
@pause
/programs/heed/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm heed.asm heed
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/hello/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm hello.asm hello
@pause
/programs/hello/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm hello.asm hello
@pause
/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/hexhd/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm hexhd.asm hexhd
@pause
/programs/hexhd/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm hexhd.asm hexhd
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/hexview/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm hexview.asm hexview
@pause
/programs/hexview/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm hexview.asm hexview
@pause
/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:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/httpc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm httpc.asm httpc
@pause
/programs/httpc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm httpc.asm httpc
@pause
/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 eax,'<!--'
jne no_com2_start
mov [com2],1
 
no_com2_start:
mov ax,[esi+0x10000] ; -->
cmp ax,'->'
jne no_com2_end
mov [com2],0
inc esi
jmp byte_done
 
no_com2_end:
mov eax,[esi+0x10000] ; <script
cmp eax,'<scr'
jne no_script_start
mov [script],1
 
no_script_start:
mov eax,[esi+0x10000] ; /script>
cmp eax,'</sc'
jne no_script_end
mov [script],0
inc esi
jmp byte_done
 
no_script_end:
cmp [command_on_off],0
jne no_print
 
cmp [com2],0
jne no_print
 
cmp [script],0
jne no_print
 
mov al,[esi+0x10000] ; &
cmp al,'&'
jne no_nbsp
 
newsps:
inc esi
mov al,[esi+0x10000] ;
cmp al,';'
jne newsps
jmp byte_done
 
no_nbsp:
cmp al,13
jne no_lb
jmp byte_done
 
no_lb:
cmp al,10
jne no_lf
jmp byte_done
 
no_lf:
mov ebx,[pagey]
imul ebx,[pagexs]
add ebx,[pagex]
add ebx,0x20000
and eax,0xff
cmp eax,31
jbe byte_done
cmp [lastletter],al
jne letter_ok
cmp al,' '
je byte_done
 
letter_ok:
mov [ebx],al
mov dl,[text_type]
mov [ebx+0x10000],dl
mov [pageyinc],0
mov [lastletter],al
 
inc [pagex]
 
mov ebx,[pagex]
cmp ebx,[pagexs]
jb byte_done
mov [pagex],0
inc [pagey]
 
jmp byte_done
 
no_print:
; HTML -COMMAND
 
mov ax,[esi+0x10000] ; b> bold
cmp ax,'b>'
jne no_bold_start
mov [text_type],2
 
no_bold_start:
mov eax,[esi+0x10000] ; /b bold end
cmp eax,'</b>'
jne no_bold_end
mov [text_type],1
add esi,2
 
no_bold_end:
mov ax,[esi+0x10000] ; <a
cmp ax,'a '
jne no_link_start
mov [text_type],128
add esi,2
 
no_link_start:
mov ax,[esi+0x10000] ; /a
cmp ax,'/a'
jne no_link_end2
mov [text_type],1
add esi,0
 
no_link_end2:
mov ax,[esi+0x10000]
cmp ax,'br'
jne no_br
call linefeed
inc esi
 
no_br:
mov ax,[esi+0x10000]
cmp ax,'td'
jne no_td
call linefeed
inc esi
 
no_td:
mov eax,[esi+0x10000]
cmp eax,'tabl'
jne no_table
call linefeed
add esi,3
 
no_table:
byte_done:
inc esi
cmp esi,[pos]
jbe newbyte
 
mov [display_from],0
call display_page
 
popa
ret
 
 
 
;****************************************************************************
; Function
; linefeed
;
; Description
;
;
;****************************************************************************
linefeed:
cmp [pageyinc],2
jge nolf
 
mov [pagex],0
inc [pagey]
inc [pageyinc]
 
nolf:
ret
 
 
 
;****************************************************************************
; Function
; display_page
;
; Description
; Renders the text decoded by draw_page
;
;****************************************************************************
display_page:
pusha
 
mov eax,0
mov ebx,0
 
newpxy:
push eax
push ebx
 
mov eax,13 ; background for letter
mov ebx,[esp+4]
imul ebx,6
add ebx,[dpx]
shl ebx,16
add ebx,6
mov ecx,[esp+0]
imul ecx,10
add ecx,[dpy]
shl ecx,16
add ecx,10
mov edx,0xffffff
int 0x40
 
mov eax,4
mov ebx,[esp+4]
imul ebx,6
add ebx,[dpx]
shl ebx,16
 
mov bx,[esp+0]
imul bx,10
add bx,word [dpy]
 
mov esi,[esp]
imul esi,[pagexs]
add esi,[esp+4]
 
mov edx,[display_from]
imul edx,[pagexs]
add edx,0x20000
add edx,esi
 
movzx ecx,byte [edx+0x10000]
cmp ecx,1
jne noecx1
mov ecx,0x000000
 
noecx1:
movzx ecx,byte [edx+0x10000]
cmp ecx,2
jne noecx2
mov ecx,0xff0000
 
noecx2:
cmp ecx,128
jne noecx128
mov ecx,0x0000ff
 
noecx128:
mov esi,1
 
int 0x40
 
pop ebx
pop eax
 
inc eax
cmp eax,[pagexs]
jb newpxy
mov eax,0
inc ebx
cmp ebx,30
jb newpxy
 
popa
ret
 
 
 
 
;****************************************************************************
; Function
; socket_commands
;
; Description
; opens or closes the socket
;
;****************************************************************************
socket_commands:
cmp ah,22 ; open socket
jnz tst3
 
; Clear all page memory
mov edi,0x10000
mov ecx,0x30000
mov al,0
cld
rep stosb
 
; Parse the entered url
call parse_url
 
; Get a free port number
mov ecx, 1000 ; local port starting at 1000
getlp1:
inc ecx
push ecx
mov eax, 53
mov ebx, 9
int 0x40
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp1 ; yes - so try next
 
mov eax,53
mov ebx,5
mov edx,80
mov esi,dword [server_ip]
mov edi,1
int 0x40
mov [socket], eax
 
mov [pos],0
mov [pagex],0
mov [pagey],0
mov [pagexs],80
mov [command_on_off],0
 
ret
 
tst3:
cmp ah,24 ; close socket
jnz no_24
 
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
 
call draw_page
 
ret
 
no_24:
ret
 
 
 
;****************************************************************************
; Function
; parse_url
;
; Description
; parses the full url typed in by the user into a web address ( that
; can be turned into an IP address by DNS ) and the page to display
; DNS will be used to translate the web address into an IP address, if
; needed.
; url is at document_user and will be space terminated.
; web address goes to webAddr and is space terminated.
; ip address goes to server_ip
; page goes to document and is space terminated.
;
; Supported formats:
; <protocol://>address<page>
; <protocol> is optional, removed and ignored - only http supported
; <address> is required. It can be an ip address or web address
; <page> is optional and must start with a leading / character
;
;****************************************************************************
parse_url:
; First, reset destination variables
cld
mov al, ' '
mov edi, document
mov ecx,URLMAXLEN
rep stosb
mov edi, webAddr
mov ecx,URLMAXLEN
rep stosb
mov al, '/'
mov [document], al
 
mov esi, document_user
; remove any leading protocol text
mov ecx, URLMAXLEN
mov ax, '//'
 
pu_000:
cmp [esi], byte ' ' ; end of text?
je pu_002 ; yep, so not found
cmp word [esi], ax
je pu_001 ; Found it, so esi+2 is start
inc esi
loop pu_000
 
pu_002:
; not found, so reset esi to start
mov esi, document_user -2
 
pu_001:
add esi, 2
 
mov ebx, esi ; save address of start of web address
mov edi, document_user + URLMAXLEN ; end of string
 
; look for page delimiter - it's a '/' character
pu_003:
cmp [esi], byte ' ' ; end of text?
je pu_004 ; yep, so none found
cmp esi, edi ; end of string?
je pu_004 ; yep, so none found
cmp [esi], byte '/' ; delimiter?
je pu_005 ; yep - process it
inc esi
jmp pu_003
 
pu_005:
; copy page to document address
; esi = delimiter
push esi
inc esi
mov ecx, edi ; end of document_user
mov edi, document
cld
 
pu_006:
movsb
cmp esi, ecx
je pu_007 ; end of string?
cmp [esi], byte ' ' ; end of text
je pu_007
jmp pu_006
 
pu_007:
pop esi ; point esi to '/' delimiter
 
pu_004:
; copy web address to webAddr
; start in ebx, end in esi-1
mov ecx, esi
mov esi, ebx
mov edi, webAddr
cld
 
pu_008:
movsb
cmp esi, ecx
je pu_009
jmp pu_008
 
pu_009:
; For debugging, display resulting strings
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, document_user
call debug_print_string
mov esi, webAddr
call debug_print_string
mov esi, document
call debug_print_string
end if
 
; Look up the ip address, or was it specified?
mov al, [webAddr]
cmp al, '0'
jb pu_010 ; Resolve address
cmp al, '9'
ja pu_010 ; Resolve address
 
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str2 ; print gotip
call debug_print_string
end if
 
; Convert address
mov esi,webAddr-1
mov edi,server_ip
xor eax,eax
ip1:
inc esi
cmp [esi],byte '0'
jb ip2
cmp [esi],byte '9'
jg ip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp ip1
ip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,server_ip+3
jbe ip1
 
jmp pu_011
 
pu_010:
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str1 ; print resolving
call debug_print_string
end if
 
; Resolve Address
call translateData ; Convert domain & DNS IP address
call resolveDomain ; get ip address
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str3
call debug_print_string
end if
 
pu_011:
 
; Done
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
;
;***************************************************************************
translateData:
 
; first, get the IP address of the DNS server
; Then, build up the request string.
 
 
; 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, webAddr
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, dword [dns_ip]
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]
 
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
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str4
call debug_print_string
end if
 
; 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 [server_ip], 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
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
pusha
mov esi, str4
call debug_print_string
popa
end if
 
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 [server_ip], eax
ret
 
 
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:
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
 
mov dl, ah
 
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
 
cmp dl, 1
je exit
 
mov [socketNum], dword 0xFFFF
mov [server_ip], dword 0
 
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
 
 
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
 
;****************************************************************************
; Function
; debug_print_string
;
; Description
; prints a string to the debug board, in quotes
;
; esi holds ptr to msg to display, which is space or 0 terminated
;
; Nothing preserved; I'm assuming a pusha/popa is done before calling
;
;****************************************************************************
debug_print_string:
push esi
mov cl, '"'
mov eax,63
mov ebx, 1
int 0x40
pop esi
 
dps_000:
mov cl, [esi]
cmp cl, 0
je dps_exit
cmp cl, ' '
je dps_exit
jmp dps_001
 
dps_exit:
mov cl, '"'
mov eax,63
mov ebx, 1
int 0x40
mov cl, 13
mov eax,63
mov ebx, 1
int 0x40
mov cl, 10
mov eax,63
mov ebx, 1
int 0x40
ret
 
dps_001:
mov eax,63
mov ebx, 1
push esi
int 0x40
 
pop esi
inc esi
jmp dps_000
end if
 
 
;****************************************************************************
; Function
; print_text
;
; Description
; display the url (full path) text
;
;****************************************************************************
print_text:
; Draw a bar to blank out previous text
mov eax,13
mov ebx,30*65536+URLMAXLEN*6 ; 50 should really be [len], and 103 [xa]
mov ecx,[ya]
shl ecx,16
mov cx,9
mov edx,0xFFFFFF
int 0x40
 
; write text
mov eax,4
mov ebx,30*65536
add ebx,[ya]
mov ecx,0x000000
mov edx,[addr]
mov esi,URLMAXLEN
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
mov eax,0 ; function 0 : define and draw window
mov ebx,50*65536+550 ; [x start] *65536 + [x size]
mov ecx,50*65536+400 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; 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
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 esi, URLMAXLEN ; URL
mov eax,4 ; function 4 : write text to window
mov ebx,30*65536+38 ; [x start] *65536 + [y start]
mov ecx,0x000000 ; color of text RRGGBB
mov edx,document_user ; pointer to text beginning
int 0x40
 
mov eax,38
mov ebx,5*65536+545
mov ecx,60*65536+60
mov edx,0x000000
int 0x40
 
mov eax,38
mov ebx,5*65536+545
mov ecx,[winys]
shl ecx,16
add ecx,[winys]
sub ecx,26*65536+26
mov edx,0x000000
int 0x40
; RELOAD
mov eax,8 ; function 8 : define and draw button
mov ebx,388*65536+50 ; [x start] *65536 + [x size]
mov ecx,34*65536+14 ; [y start] *65536 + [y size]
mov edx,22 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
 
; URL
mov eax,8 ; function 8 : define and draw button
mov ebx,10*65536+12 ; [x start] *65536 + [x size]
mov ecx,34*65536+12 ; [y start] *65536 + [y size]
mov edx,10 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
 
; STOP
mov eax,8 ; function 8 : define and draw button
mov ebx,443*65536+50 ; [x start] *65536 + [x size]
mov ecx,34*65536+14 ; [y start] *65536 + [y size]
mov edx,24 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
 
; BUTTON TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,390*65536+38 ; [x start] *65536 + [y start]
mov ecx,0xffffff ; color of text RRGGBB
mov edx,button_text ; pointer to text beginning
mov esi,20 ; text length
int 0x40
 
call display_page
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
if DEBUGGING_STATE = DEBUGGING_ENABLED
str1: db "Resolving...",0
str3: db "Resolved",0
str2: db "GotIP",0
str4: db "GotResponse",0
end if
 
button_text db ' RELOAD STOP '
dpx dd 25 ; x - start of html page in pixels in window
dpy dd 65 ; for y
lastletter db 0
pageyinc dd 0
display_from dd 20
pos dd 0x0
pagex dd 0x0
pagey dd 0x0
pagexs dd 80
command_on_off dd 0x0
text_type db 1
com2 dd 0x0
script dd 0x0
socket dd 0x0
 
addr dd 0x0
ya dd 0x0
len dd 0x00
 
labelt: db 'HTTPC - PgUp/PgDown'
labellen:
 
server_ip: db 207,44,212,20
dns_ip: db 194,145,128,1
webAddr: times 128 db ' '
document_user: db 'Click on the button to the left to enter a URL',0
times 100 db 0x0
document: db '/'
times 100 db ' '
 
string0: db 'GET '
 
stringh: db ' HTTP/1.0',13,10,13,10
stringh_end:
 
status dd 0x0
prev_status dd 0x0
 
onoff dd 0x0
 
nextupdate: dd 0
winys: dd 400
 
dnsMsgLen: dd 0
socketNum: dd 0xFFFF
dnsMsg:
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/httpc/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/https/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm https.asm https
@pause
/programs/https/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm https.asm https
@pause
/programs/https/trunk/https.asm
0,0 → 1,1394
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Tiny HTTP Server v 0.4 for MenuetOS ;
; ;
; License GPL / See file COPYING for details. ;
; Copyright 2003 Ville Turjanmaa ;
; ;
; Compile with FASM for Menuet ;
; ;
; Request /TinyStat for server statistics ;
; Request /TinyBoard for server message board ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
version equ '0.4'
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x400000 ; required amount of memory
dd 0x20000
dd 0,0 ; reserved=no extended header
 
include 'lang.inc'
include "macros.inc"
 
; 0x0+ - program image
; 0x1ffff - stack
; 0x20000+ - message board
; 0x100000+ - requested file
 
filel:
dd 0x0,0x0,50000/512,0x20000,0x70000
db '/rd/1/board.htm',0
 
files:
dd 0x1,0x0,0x0,0x20000,0x70000
db '/rd/1/board.htm',0
 
 
 
START: ; start of execution
 
mov eax,58
mov ebx,filel
int 0x40
mov [board_size],ebx
cmp eax,0
je board_found
 
mov [board_size],board_end-board
mov esi,board
mov edi,0x20000
mov ecx,[board_size]
cld
rep movsb
 
board_found:
 
mov eax,58
mov ebx,files
mov ecx,[board_size]
mov [files+8],ecx
int 0x40
 
mov [status],-1
mov [last_status],-2
call clear_input
call draw_window ; at first, draw the window
 
; call ops
 
still:
 
call check_status
cmp [status],4
je start_transmission
 
cmp [status],0
jne nnn
cmp [server_active],1
jne nnn
call ops
nnn:
 
mov eax,5
mov ebx,1
int 0x40
 
mov eax,11
int 0x40
call check_events
 
jmp still
 
 
reb: ; boot
 
mov eax,18
mov ebx,1
int 0x40
 
jmp $
 
 
last_status dd 0x0
 
check_events:
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
 
ret
 
red: ; redraw
call draw_window
ret
 
key: ; Keys are not valid at this part of the
mov eax,2 ; loop. Just read it and ignore
int 0x40
ret
 
button: ; button
 
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; close
jnz tst2
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
mov eax,-1
int 0x40
tst2:
 
cmp ah,2 ; button id=2 ?
jnz tst3
; open socket
ops:
mov eax,53
mov ebx,5
mov ecx,80 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
mov [posy],1
mov [posx],0
call check_for_incoming_data
call clear_input
call draw_data
mov [server_active],1
call check_status
; cmp [status],0
; je reb
ret
tst3:
 
cmp ah,4 ; button id=4 ?
jnz no4
mov [server_active],0
close_socket:
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
mov eax,5
mov ebx,2
int 0x40
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
 
cmp [server_active],1
jne no_re_open
mov eax,53
mov ebx,5
mov ecx,80 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
no_re_open:
 
mov edi,input_text+256*15+1
mov [edi+2],dword ': :'
call set_time
mov edi,input_text+256*16+1
mov [edi+2],dword '. .'
call set_date
 
mov eax,[documents_served]
mov ecx,9
mov edi,input_text+256*15+12
call set_value
 
mov eax,[bytes_transferred]
mov ecx,9
mov edi,input_text+256*16+12
call set_value
 
call draw_data
 
mov esp,0x1ffff
jmp still
no4:
 
cmp ah,6 ; read directory
je read_string
 
ret
 
 
clear_input:
 
mov edi,input_text
mov eax,0
mov ecx,256*30
cld
rep stosb
 
ret
 
 
retries dd 50
 
start_transmission:
 
mov [posy],1
mov [posx],0
call clear_input
mov [retries],50
 
wait_for_data:
call check_for_incoming_data
cmp [input_text+256+1],dword 'GET '
je data_received
cmp [input_text+256+1],dword 'POST'
je data_received
mov eax,5
mov ebx,1
int 0x40
dec [retries]
jnz wait_for_data
jmp no_http_request
data_received:
 
mov eax,0x100000
mov ebx,0x2f0000 / 512
call read_file
 
call wait_for_empty_slot
call send_header
 
mov [filepos],0x100000
mov [fileadd],700
 
call check_status
call draw_data
 
newblock:
 
call wait_for_empty_slot
 
mov edx,[fileadd]
cmp edx,[file_left]
jbe file_size_ok
mov edx,[file_left]
file_size_ok:
sub [file_left],edx
 
; write to socket
mov eax,53
mov ebx,7
mov ecx,[socket]
mov esi,[filepos]
int 0x40
 
mov eax,esi
add eax,edx
sub eax,0x100000
call display_progress
 
mov edx,[fileadd]
add [filepos],edx
 
cmp [file_left],0
jg newblock
 
no_http_request:
 
jmp close_socket
 
 
filepos dd 0x100000
fileadd dd 0x1
filesize dd 0x0
file_left dd 0x0
 
 
wait_for_empty_slot:
 
pusha
 
wait_more:
 
; rdtsc
; mov ecx,eax
; add ecx,1000000
; wr:
; rdtsc
; cmp eax,ecx
; jb wr
 
mov eax,5
mov ebx,1
int 0x40
 
mov eax,11
int 0x40
call check_events
 
mov eax,53
mov ebx,255
mov ecx,103
int 0x40
 
cmp eax,0
je no_wait_more
 
jmp wait_more
 
no_wait_more:
 
popa
ret
 
 
 
 
display_progress:
 
pusha
 
mov edi,eax
 
mov eax,13
mov ebx,115*65536+8*6
mov ecx,178*65536+10
mov edx,0xffffff
int 0x40
 
mov eax,47
mov ebx,8*65536
mov ecx,edi
mov edx,115*65536+178
mov esi,0x000000
int 0x40
 
popa
ret
 
 
send_header:
 
pusha
 
mov eax,53 ; send response and file length
mov ebx,7
mov ecx,[socket]
mov edx,h_len-html_header
mov esi,html_header
int 0x40
 
mov eax,53 ; send file type
mov ebx,7
mov ecx,[socket]
mov edx,[type_len]
mov esi,[file_type]
int 0x40
 
popa
ret
 
 
fileinfo dd 0,0,1,0x100000,0xf0000
getf db '/RD/1/'
times 50 db 0
wanted_file: times 100 db 0
 
getflen dd 6
 
make_room:
 
pusha
 
mov edx,ecx
 
mov esi,0x20000
add esi,[board_size]
mov edi,esi
add edi,edx
mov ecx,[board_size]
sub ecx,board1-board
inc ecx
std
rep movsb
cld
 
popa
ret
 
 
from_i dd 0x0
from_len dd 0x0
 
message dd 0x0
message_len dd 0x0
 
read_file: ; start of execution
 
mov [fileinfo+12],eax
mov [fileinfo+8],ebx
 
mov [file_type],unk
mov [type_len],unkl-unk
mov [filename+40*2+6],dword 'UNK '
 
cmp [input_text+256+1],dword 'POST'
je yes_new_message
 
cmp [input_text+256+11],dword 'oard' ; server board message
jne no_server_message_2
 
yes_new_message:
 
mov eax,58
mov ebx,filel
int 0x40
mov [board_size],ebx
 
cmp [input_text+256+1],dword 'POST'
jne no_new_message
 
mov edi,bsmt
call set_time
mov edi,bsmd
call set_date
 
call check_for_incoming_data
 
mov esi,input_text+256 ; from
newfroms:
inc esi
cmp esi,input_text+256*20
je no_server_message_2
cmp [esi],dword 'from'
jne newfroms
 
add esi,5
mov [from_i],esi
 
mov edx,0
name_new_len:
cmp [esi+edx],byte 13
je name_found_len
cmp [esi+edx],byte '&'
je name_found_len
cmp edx,1000
je name_found_len
inc edx
jmp name_new_len
name_found_len:
 
mov [from_len],edx
 
mov esi,input_text+256
newmessages:
inc esi
cmp esi,input_text+256*20
je no_server_message_2
cmp [esi],dword 'sage'
jne newmessages
 
add esi,5
mov [message],esi
 
mov edx,0
new_len:
inc edx
cmp [esi+edx],byte ' '
je found_len
cmp [esi+edx],byte 13
jbe found_len
cmp edx,input_text+5000
je found_len
jmp new_len
found_len:
mov [message_len],edx
 
 
mov edx,0
 
change_letters:
 
cmp [esi+edx],byte '+'
jne no_space
mov [esi+edx],byte ' '
no_space:
 
cmp [esi+edx+1],word '0D'
jne no_br
mov [esi+edx],dword '<br>'
mov [esi+edx+4],word ' '
no_br:
 
cmp [esi+edx],byte '%'
jne no_ascii
movzx eax,byte [esi+edx+2]
sub eax,48
cmp eax,9
jbe eax_ok
sub eax,7
eax_ok:
movzx ebx,byte [esi+edx+1]
sub ebx,48
cmp ebx,9
jbe ebx_ok
sub ebx,7
ebx_ok:
imul ebx,16
add ebx,eax
mov [esi+edx],bl
mov [esi+edx+1],word ' '
add edx,2
no_ascii:
 
inc edx
cmp edx,[message_len]
jbe change_letters
 
 
mov edx,board1e-board1 + board2e-board2 + board3e-board3
add edx,[from_len]
add edx,[message_len]
 
add [board_size],edx
 
mov ecx,edx
call make_room
 
 
mov esi,board1 ; first part
mov edi,0x20000
add edi,board1-board
mov ecx,edx
cld
rep movsb
 
mov esi,[from_i] ; name
mov edi,0x20000
add edi,board1-board + board1e-board1
mov ecx,[from_len]
cld
rep movsb
 
mov esi,board2 ; middle part
mov edi,0x20000
add edi,board1-board + board1e-board1
add edi,[from_len]
mov ecx,board2e-board2
cld
rep movsb
 
mov esi,[message] ; message
mov edi,0x20000
add edi,board1-board + board1e-board1 +board2e-board2
add edi,[from_len]
mov ecx,[message_len]
cld
rep movsb
 
mov esi,board3 ; end part
mov edi,0x20000
add edi,board1-board + board1e-board1 +board2e-board2
add edi,[from_len]
add edi,[message_len]
mov ecx,board3e-board3
cld
rep movsb
 
inc [board_messages]
 
mov eax,[board_size]
mov [files+8],eax
 
mov eax,58
mov ebx,files
int 0x40
 
no_new_message:
mov esi,0x20000
mov edi,0x100000
mov ecx,[board_size]
cld
rep movsb
mov ebx,[board_size]
 
mov [file_type],htm
mov [type_len],html-htm
mov [filename+40*2+6],dword 'HTM '
 
jmp file_loaded
no_server_message_2:
 
cmp [input_text+256+9],dword 'ySta' ; server message
jne no_server_message_1
mov edi,smt
call set_time
mov edi,smd
call set_date
mov eax,[documents_served]
mov ecx,9
mov edi,sms+21
call set_value
mov eax,[bytes_transferred]
mov ecx,9
mov edi,smb+21
call set_value
mov eax,[board_messages]
mov ecx,9
mov edi,smm+21
call set_value
mov eax,[board_size]
mov ecx,9
mov edi,smz+21
call set_value
mov esi,sm
mov edi,0x100000
mov ecx,sme-sm
cld
rep movsb
mov ebx,sme-sm
 
mov [file_type],htm
mov [type_len],html-htm
mov [filename+40*2+6],dword 'HTM '
 
jmp file_loaded
no_server_message_1:
 
mov esi,input_text+256+6
cmp [input_text+256+1],dword 'GET '
jne no_new_let
mov edi,wanted_file
cld
new_let:
cmp [esi],byte ' '
je no_new_let
cmp edi,wanted_file+30
jge no_new_let
movsb
jmp new_let
no_new_let:
mov [edi+0],dword 0
mov [edi+4],dword 0
mov [edi+8],dword 0
 
cmp esi,input_text+256+6
jne no_index
mov edi,wanted_file
mov [edi+0],dword 'inde'
mov [edi+4],dword 'x.ht'
mov [edi+8],byte 'm'
mov [edi+9],byte 0
add edi,9
 
mov [file_type],htm
mov [type_len],html-htm
mov [filename+40*2+6],dword 'HTM '
 
jmp html_file
no_index:
 
cmp [edi-3],dword 'htm'+0
je htm_header
cmp [edi-3],dword 'HTM'+0
je htm_header
jmp no_htm_header
htm_header:
mov [file_type],htm
mov [type_len],html-htm
mov [filename+40*2+6],dword 'HTM '
jmp found_file_type
no_htm_header:
 
cmp [edi-3],dword 'png'+0
je png_header
cmp [edi-3],dword 'PNG'+0
je png_header
jmp no_png_header
png_header:
mov [file_type],png
mov [type_len],pngl-png
mov [filename+40*2+6],dword 'PNG '
jmp found_file_type
no_png_header:
 
cmp [edi-3],dword 'gif'+0
je gif_header
cmp [edi-3],dword 'GIF'+0
je gif_header
jmp no_gif_header
gif_header:
mov [file_type],gif
mov [type_len],gifl-gif
mov [filename+40*2+6],dword 'GIF '
jmp found_file_type
no_gif_header:
 
cmp [edi-3],dword 'jpg'+0
je jpg_header
cmp [edi-3],dword 'JPG'+0
je jpg_header
jmp no_jpg_header
jpg_header:
mov [file_type],jpg
mov [type_len],jpgl-jpg
mov [filename+40*2+6],dword 'JPG '
jmp found_file_type
no_jpg_header:
 
cmp [edi-3],dword 'asm'+0
je txt_header
cmp [edi-3],dword 'ASM'+0
je txt_header
cmp [edi-3],dword 'txt'+0
je txt_header
cmp [edi-3],dword 'TXT'+0
je txt_header
jmp no_txt_header
txt_header:
mov [file_type],txt
mov [type_len],txtl-txt
mov [filename+40*2+6],dword 'TXT '
jmp found_file_type
no_txt_header:
 
html_file:
 
found_file_type:
 
mov edi,getf
add edi,[getflen]
mov esi,wanted_file
mov ecx,40
cld
rep movsb
 
mov esi,getf
mov edi,filename
mov ecx,35
cld
rep movsb
 
mov [fileinfo+8],dword 1 ; file exists ?
mov eax,58
mov ebx,fileinfo
int 0x40
 
cmp eax,0 ; file not found - message
je file_found
mov edi,et
call set_time
mov edi,ed
call set_date
mov esi,fnf
mov edi,0x100000
mov ecx,fnfe-fnf
cld
rep movsb
mov ebx,fnfe-fnf
 
mov [file_type],htm
mov [type_len],html-htm
mov [filename+40*2+6],dword 'HTM '
 
jmp file_not_found
 
file_found:
 
mov [fileinfo+8],dword 0x2f0000 / 512 ; read all of file
mov eax,58
mov ebx,fileinfo
int 0x40
 
file_not_found:
file_loaded:
 
and ebx,0x3fffff
mov [filesize],ebx
mov [file_left],ebx
 
mov eax,ebx
mov edi,c_l+5
mov ebx,10
newl:
xor edx,edx
div ebx
mov ecx,edx
add cl,48
mov [edi],cl
dec edi
cmp edi,c_l
jge newl
 
mov esi,c_l
mov edi,filename+46
mov ecx,7
cld
rep movsb
 
inc [documents_served]
mov eax,[filesize]
add [bytes_transferred],eax
 
call draw_data
 
ret
 
 
set_value:
 
pusha
 
add edi,ecx
mov ebx,10
new_value:
xor edx,edx
div ebx
add dl,48
mov [edi],dl
dec edi
loop new_value
 
popa
ret
 
 
set_time:
 
pusha
 
mov eax,3
int 0x40
 
mov ecx,3
new_time_digit:
mov ebx,eax
and ebx,0xff
shl ebx,4
shr bl,4
add bx,48*256+48
mov [edi],bh
mov [edi+1],bl
add edi,3
shr eax,8
loop new_time_digit
 
popa
ret
 
 
 
set_date:
 
pusha
 
mov eax,29
int 0x40
 
mov ecx,3
add edi,6
new_date_digit:
mov ebx,eax
and ebx,0xff
shl ebx,4
shr bl,4
add bx,48*256+48
mov [edi],bh
mov [edi+1],bl
sub edi,3
shr eax,8
loop new_date_digit
 
popa
ret
 
 
 
check_for_incoming_data:
 
pusha
 
check:
 
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
 
cmp eax,0
je _ret_now
 
new_data:
 
mov eax,53
mov ebx,2
mov ecx,[socket]
int 0x40
 
cmp eax,0
je _ret
 
mov eax,53
mov ebx,3
mov ecx,[socket]
int 0x40
 
cmp bl,10
jne no_lf
inc [posy]
mov [posx],0
jmp new_data
no_lf:
 
cmp bl,20
jb new_data
 
inc [posx]
cmp [posy],20
jbe yok
mov [posy],1
yok:
 
mov eax,[posy]
imul eax,256
add eax,[posx]
 
mov [input_text+eax],bl
 
jmp new_data
 
_ret:
 
call draw_data
 
mov eax,5
mov ebx,1
cmp [input_text+256+1],dword 'POST'
jne no_ld
mov ebx,50
no_ld:
int 0x40
 
jmp check
 
_ret_now:
 
popa
ret
 
 
posy dd 1
posx dd 0
 
 
check_status:
 
pusha
 
mov eax,53
mov ebx,6
mov ecx,[socket]
int 0x40
 
cmp eax,[status]
je c_ret
mov [status],eax
add al,48
mov [text+12],al
call draw_data
c_ret:
 
popa
ret
 
 
addr dd 0x0
ya dd 0x0
 
filename2: times 100 db 32
 
read_string:
 
mov [addr],dword getf
mov [ya],dword 139
 
mov edi,[addr]
mov eax,0
mov ecx,30
cld
rep stosb
 
call print_text
 
mov edi,[addr]
 
f11:
mov eax,10
int 0x40
cmp eax,2
jne read_done
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je read_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
sub edi,1
mov [edi],byte 32
call print_text
jmp f11
nobsl:
mov [edi],al
 
call print_text
 
add edi,1
mov esi,[addr]
add esi,30
cmp esi,edi
jnz f11
 
read_done:
 
push edi
 
mov ecx,40
mov eax,32
cld
rep stosb
 
call print_text
 
pop edi
sub edi,[addr]
mov [getflen],edi
 
mov esi,getf
mov edi,dirp+12
mov ecx,28
cld
rep movsb
 
jmp still
 
 
print_text:
 
pusha
 
mov eax,13
mov ebx,97*65536+23*6
mov ecx,[ya]
shl ecx,16
mov cx,9
mov edx,0xffffff
int 0x40
 
mov eax,4
mov edx,[addr]
mov ebx,97*65536
add ebx,[ya]
mov ecx,0x000000
mov esi,23
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,100*65536+480 ; [x start] *65536 + [x size]
mov ecx,100*65536+215 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x8050a0b0 ; color of grab bar RRGGBB,8->color gl
mov edi,0x0050a0b0 ; 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,0x10ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
mov eax,8 ; function 8 : define and draw button
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
mov ecx,59*65536+9 ; [y start] *65536 + [y size]
mov edx,2 ; button id
mov esi,0x66aa66 ; button color RRGGBB
int 0x40
 
mov eax,8 ; function 8 : define and draw button
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
mov ecx,72*65536+9 ; [y start] *65536 + [y size]
mov edx,4 ; button id
mov esi,0xaa6666 ; button color RRGGBB
int 0x40
 
mov eax,8 ; Enter directory
mov ebx,(25)*65536+66
mov ecx,135*65536+15
mov edx,6
mov esi,0x3388dd
int 0x40
 
mov eax,38
mov ebx,240*65536+240
mov ecx,22*65536+210
mov edx,0x6699cc ; 002288
int 0x40
 
mov eax,38
mov ebx,241*65536+241
mov ecx,22*65536+210
mov edx,0x336699 ; 002288
int 0x40
 
call draw_data
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
draw_data:
 
pusha
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0x000000
mov edx,text
mov esi,35
newline:
pusha
cmp ebx,25*65536+61
je now
cmp ebx,25*65536+74
je now
cmp ebx,25*65536+74+13*5
je now
mov ecx,ebx
mov bx,35*6
shl ecx,16
mov cx,9
mov eax,13
mov edx,0xffffff
int 0x40
now:
popa
mov eax,4
int 0x40
add ebx,13
add edx,40
cmp [edx],byte 'x'
jnz newline
 
mov [input_text+0],dword 'RECE'
mov [input_text+4],dword 'IVED'
mov [input_text+8],dword ': '
 
mov ebx,255*65536+35 ; draw info text with function 4
mov ecx,0x000000
mov edx,input_text
mov esi,35
mov edi,17
newline2:
pusha
mov ecx,ebx
mov bx,35*6
shl ecx,16
mov cx,9
mov eax,13
mov edx,0xffffff
int 0x40
popa
mov eax,4
int 0x40
add ebx,10
add edx,256
dec edi
jnz newline2
 
popa
 
ret
 
 
; DATA AREA
 
status dd 0x0
 
text:
db 'TCB status: x '
db ' '
db ' Activate server '
db ' Stop server '
db ' '
db 'Requests: /TinyStat -statistics '
db ' /TinyBoard -message board '
db ' '
dirp:
db ' Files: /RD/1/ '
db ' '
filename:
db ' '
db 'Size: ------- '
db 'Type: --- '
db 'x' ; <- END MARKER, DONT DELETE
 
 
html_header:
 
db 'HTTP/1.0 200 OK',13,10
db 'Server: MenuetOS HTTP Server',13,10
db 'Content-Length: '
c_l: db '000000',13,10
 
h_len:
 
fnf:
db '<body>'
db '<pre>'
db "TinyServer v ",version," for MenuetOS",13,10,13,10
db "Error 404 - File not found.",13,10,13,10
db "For more info about server: request /TinyStat",13,10,13,10
et: db "xx:xx:xx",13,10
ed: db "xx.xx.xx",13,10
db "</pre></body>"
fnfe:
 
 
sm:
db '<body>'
db '<pre>'
db "TinyServer v ",version," for MenuetOS",13,10,13,10
db "Statistics: (before current request)",13,10,13,10
sms: db "- Documents served : xxxxxxxxx",13,10
smb: db "- Bytes transferred : xxxxxxxxx",13,10
db "- Location : <a href=/TinyStat>/TinyStat</a>",13,10,13,10
db "TinyBoard:",13,10,13,10
smm: db "- Messages : xxxxxxxxx",13,10
smz: db "- Size in bytes : xxxxxxxxx",13,10
db "- Location : <a href=/TinyBoard>/TinyBoard</a>",13,10,13,10
smt: db "xx:xx:xx",13,10
smd: db "xx.xx.xx",13,10
db '</pre></body>'
sme:
 
documents_served dd 0x0
bytes_transferred dd 0x0
 
file_type dd 0
type_len dd 0
 
htm: db 'Content-Type: text/html',13,10,13,10
html:
txt: db 'Content-Type: text/plain',13,10,13,10
txtl:
png: db 'Content-Type: image/png',13,10,13,10
pngl:
gif: db 'Content-Type: image/gif',13,10,13,10
gifl:
jpg: db 'Content-Type: image/jpeg',13,10,13,10
jpgl:
unk: db 'Content-Type: unknown/unknown',13,10,13,10
unkl:
 
 
labelt: db 'Tiny http server ',version
labellen:
 
socket dd 0x0
server_active db 0x0
 
board:
 
db "<HTML><BODY BGCOLOR=#ffffff ALINK=black VLINK=black><br>",13,10
db "<center>",13,10
db "<TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0 bgcolor=#ffffff width=600>"
db 13,10
db "<TR VALIGN=top><TD ALIGN=center bgcolor=f0f0f8>",13,10
db "<font size=3>Tinyserver Messageboard</TD></TR></TABLE><br>",13,10
db "<TABLE CELLPADDING=14 CELLSPACING=2 BORDER=0 bgcolor=#ffffff width=600>"
db 13,10,13,10
 
board1:
 
db "<TR VALIGN=top>",13,10
db "<TD ALIGN=left width=80 bgcolor=f0f0f8><P>",13,10
db "<font size=3>",13,10
board1e:
db "WebMaster",13,10
board2:
db "</font>",13,10
db "<br><br><br>",13,10
db "<br><br><br><br>",13,10
bsmt:
db "12.23.45<br>",13,10
bsmd:
db "02.05.03",13,10
db "</P></TD>",13,10
db "<TD bgcolor=f0f0f8><P>",13,10
board2e:
db "Assembly written messageboard from assembly written MenuetOS.<br>"
db 13,10
board3:
db "</P></TD></TR>",13,10,13,10
board3e:
 
boardadd:
 
db "</TABLE>",13,10
db "<br>",13,10
db "<TABLE CELLPADDING=14 CELLSPACING=3 BORDER=0 bgcolor=#ffffff width=600>"
db 13,10
db "<TR VALIGN=top>",13,10
db "<TD ALIGN=left bgcolor=f0f0f8><P>",13,10
db "<form method=Post Action=/TinyBoard>",13,10
db "Name: <br><input type=text name=from size=20 MAXLENGTH=20><br>",13,10
db "Message: <br><textarea cols=60 rows=6 name=message></textarea><br>",13,10
db "<input type=Submit Value=' Send Message '></form>",13,10
db "</TD></TR>",13,10
db "</TABLE>",13,10
db "</BODY>",13,10
db "</HTML>",13,10
 
board_end:
 
board_size dd 0x0
board_messages dd 0x0
 
input_text:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/https/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/icon/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm icon.asm icon
@pause
/programs/icon/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm icon.asm icon
@pause
/programs/icon/trunk/icon.asm
0,0 → 1,534
;
; ICON APPLICATION
;
; Compile with FASM for Menuet
;
; 22.02.05 Mario79
; 1) multi-threading
; 2)dinamic load BMP files
; 3)type on desktop with function 7
; 4)Image in memory only 8000h (32Kb) for all 48 icons.
; Old version ICON 5000h*48(decimal)=960Kb.
;
 
use32
 
org 0x0
 
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x8000
dd 0x8000
dd I_Param , 0x0
 
include 'lang.inc'
include 'macros.inc'
 
get_bg_info:
mov eax,39
mov ebx,4
int 0x40
mov [bgrdrawtype],eax
 
mov eax,39 ; get background size
mov ebx,1
int 0x40
mov [bgrxy],eax
 
mov ebx,eax
shr eax,16
and ebx,0xffff
mov [bgrx],eax
mov [bgry],ebx
ret
 
START:
load_icon_list:
mov eax,6
mov ebx,icon_lst
xor ecx,ecx
mov edx,-1
mov esi,icon_data
int 0x40
 
add eax,10
xor edx,edx
mov ebx,52
div ebx
mov [icons],eax
 
call get_bg_info
 
mov eax,14
int 0x40
add eax,0x00010001
mov [scrxy],eax
 
apply_changes:
 
mov edi,[icons]
mov esi,icon_data
mov ebp,0x5000 ; threads stack starting point
 
start_new:
movzx eax,byte [esi] ; x position
sub eax,'A' ;eax - number of letter
cmp eax,4
jg no_left
shl eax,6 ;imul eax,64
add eax,24
jmp x_done
no_left:
sub eax,9
shl eax,6 ;imul eax,64
sub eax,24+32-1
movzx ebx,word [scrxy+2]
add eax,ebx
x_done:
; mov [xpos],eax
mov [ebp-12],eax
 
movzx eax,byte [esi+1] ; y position
sub eax,'A' ; eax - number of letter
cmp eax,4
jg no_up
lea eax,[eax+4*eax]
shl eax,4 ;imul eax,80
add eax,34
jmp y_done
no_up:
sub eax,9
lea eax,[eax+4*eax]
shl eax,4 ;imul eax,80
movzx ebx,word [scrxy]
sub eax,32-1
add eax,ebx
y_done:
; mov [ypos],eax
mov [ebp-8],eax
 
mov eax,51
mov ebx,1
mov ecx,thread
; mov edx,[thread_stack]
mov edx,ebp
; sub edx,4
; mov [edx],esi
mov [ebp-4],esi
int 0x40
; add [thread_stack],0x100
add ebp,0x100
 
mov eax,5
mov ebx,1
wait_thread_start: ;wait until thread draw itself first time
cmp [create_thread_event],bl
jz wait_thread_end
int 0x40
jmp wait_thread_start
wait_thread_end:
dec [create_thread_event] ;reset event
 
 
add esi,50+2
dec edi
jnz start_new
or eax,-1
int 0x40
 
thread:
; pop ebp ;ebp - address of our icon
sub esp,12
mov ebp,esp
call draw_window
mov [create_thread_event],1
mov eax,40
mov ebx,010101b
int 0x40
jmp still
red:
call draw_window
 
still:
 
mov eax,10
int 0x40
 
cmp eax,1
je red
cmp eax,3
je button
cmp eax,5
jne still
 
call get_bg_info
mov eax,5
mov ebx,1
call draw_icon
 
jmp still
 
key:
mov eax,2
int 0x40
 
jmp still
 
button:
mov eax,17
int 0x40
 
; mcall 55,eax, , ,klick_music
 
mov ebx,[ebp+8]
add ebx,19
; lea ebx,[ebp+19]
mov eax,19
xor ecx,ecx
int 0x40
mcall 55,eax, , ,klick_music
jmp still
 
klick_music db 0x85,0x60,0x85,0x70,0x85,0x65,0
 
draw_picture:
mov [image],0x3000
xor ebx,ebx
xor ecx,ecx
mov esi,data_from_file+54+32*3*33-96
mov [pixpos],0
mov [pixpos2],32
newb:
push ebx
push ecx
 
cmp ebx,10
jb yesbpix
cmp ebx,42
jge yesbpix
cmp ecx,32
jg yesbpix
 
push esi
mov esi,data_from_file+54+32*3*33-96
sub esi,[pixpos]
 
dec [pixpos2]
cmp [pixpos2],0
jne no_correction_pixpos
add [pixpos],192
mov [pixpos2],32
no_correction_pixpos:
sub [pixpos],3
mov eax,[esi]
and eax,0xffffff
 
pop esi
 
cmp eax,0
je yesbpix
cmp eax,0xf5f5f5
je yesbpix
jmp nobpix
 
yesbpix:
 
stretch:
cmp [bgrdrawtype],dword 2
jne nostretch
; mov eax,[ypos]
mov eax,[ebp+4]
add eax,ecx
imul eax,[bgry]
cdq
movzx ebx,word [scrxy]
div ebx
imul eax,[bgrx]
push eax
; mov eax,[xpos]
mov eax,[ebp+0]
add eax,[esp+8]
imul eax,[bgrx]
cdq
movzx ebx,word [scrxy+2]
div ebx
add eax,[esp]
add esp,4
 
jmp notiled
 
nostretch:
 
cmp [bgrdrawtype],dword 1
jne notiled
; mov eax,[ypos]
mov eax,[ebp+4]
add eax,ecx
cdq
movzx ebx,word [bgrxy]
div ebx
mov eax,edx
imul eax,[bgrx]
push eax
; mov eax,[xpos]
mov eax,[ebp+0]
add eax,[esp+8]
movzx ebx,word [bgrxy+2]
cdq
div ebx
mov eax,edx
add eax,[esp]
add esp,4
 
notiled:
 
lea ecx,[eax+eax*2]
mov eax,39
mov ebx,2
int 0x40
 
nobpix:
 
pop ecx
pop ebx
 
mov edx,eax
mov eax,[image]
mov [eax],dl
inc eax
ror edx,8
mov [eax],dl
inc eax
ror edx,8
mov [eax],dl
inc eax
mov [image],eax
 
inc ebx
mov eax,[yw]
inc eax
cmp ebx,eax
jnz newb
xor ebx,ebx
 
inc ecx
 
mov eax,[ya]
add [pixpos],eax
 
cmp [top],1
jne notop
cmp ecx,38
je toponly
 
notop:
 
cmp ecx,52
jnz newb
 
toponly:
 
mov eax,7
mov ebx,0x3000
mov ecx,52 shl 16 + 52
xor edx,edx
int 0x40
mov [load_pic],0
ret
 
draw_text:
 
mov esi,[ebp+8]
add esi,33
; lea esi,[ebp+33]
push edi
mov edi,labelt
mov ecx,8
cld
rep movsb
pop edi
mov eax,labelt
news:
cmp [eax],byte 33
jb founde
inc eax
cmp eax,labelt+11
jb news
founde:
sub eax,labelt
mov [tl],eax
 
mov eax,[tl]
lea eax,[eax+eax*2] ; eax *= char_width/2
shl eax,16
 
mov ebx,27*65536+42
sub ebx,eax
 
mov eax,4
xor ecx,ecx ; black shade of text
mov edx,labelt
mov esi,[tl]
add ebx,1 shl 16 ;*65536+1
int 0x40
inc ebx
int 0x40
add ebx,1 shl 16
int 0x40
inc ebx
int 0x40
sub ebx,1 shl 16
int 0x40
dec ebx
sub ebx,1 shl 16
int 0x40
sub ebx,1 shl 16
dec ebx
int 0x40
dec ebx
add ebx,1 shl 16
int 0x40
inc ebx
mov ecx,0xffffff
 
int 0x40
mov [draw_pic],0
ret
 
load_icon_file:
mov ebx,[ebp+8]
add ebx,5
; lea ebx,[ebp+5]
 
mov eax,6
xor ecx,ecx
mov edx,-1
mov esi,data_from_file
int 0x40
 
ret
 
; for y = 32 to 0
; for x = 0 to 32
; if (pix[y][x]==0) then
; pix[y][x]=background(x,y);
 
; *********************************************
; ******* 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,[xpos-2]
mov ebx,[ebp+0-2]
; mov ecx,[ypos-2]
mov ecx,[ebp+4-2]
add ebx,[yw] ; [x start] *65536 + [x size]
add ecx,51 ; [y start] *65536 + [y size]
mov edx,0x01000000 ; color of work area RRGGBB,8->color gl
int 0x40
 
mov eax,8 ; button
mov ebx,51
mov ecx,50
mov edx,1+20000000 ; or 0x40000000
int 0x40
 
mov eax,5
mov ebx,1
draw_icon:
xchg [load_pic],bl
test bl,bl
je draw_icon_end
int 0x40
jmp draw_icon
draw_icon_end:
 
call load_icon_file
 
mov eax,5
mov ebx,1
draw_icon_2:
xchg [draw_pic],bl
test bl,bl
je draw_icon_end_2
int 0x40
jmp draw_icon_2
draw_icon_end_2:
 
mov eax,9
mov ebx,process_table
mov ecx,-1
int 0x40
; mov eax,process_table
; add eax,34
; mov ebx,[eax]
; mov [xpos],ebx
; add eax,4
; mov ebx,[eax]
; mov [ypos],ebx
 
call draw_picture
call draw_text
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
 
 
icon_lst db 'ICON LST'
 
tl dd 8
yw dd 51
ya dd 0
 
;xpos dd 15
;ypos dd 185
draw_pic db 0
load_pic db 0
create_thread_event db 0
 
labelt:
db 'SETUP '
labellen:
 
bgrxy dd 0x0
scrxy dd 0x0
bgrdrawtype dd 0x0
 
pixpos dd 0
pixpos2 db 0
 
top dd 0
 
image dd 0x3000
;thread_stack dd 0x5000
 
icons dd 0
 
 
I_Param:
 
icon_data = I_END+0x1400
process_table = I_END+0x2400
 
I_END:
 
bgrx dd ?
bgry dd ?
data_from_file:
rb 54 ;header
raw_data:
rb 32*32
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/icon/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/iconedit/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm iconedit.asm iconedit
@pause
/programs/iconedit/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm iconedit.asm iconedit
@pause
/programs/iconedit/trunk/iconedit.asm
0,0 → 1,983
;
; Modified from original icon editor
;
; Compile with FASM for Menuet
;
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x100000 ; memory for app
dd 0x7fff0 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
include 'macros.inc'
 
window_x_size equ 346
window_y_size equ 312
 
START: ; start of execution
 
call draw_window ; at first, draw the window
call get_screen_size ; get screen x and y size
 
check_mouse:
 
call draw_mouse ; are we editing the icon
call check_colour ; are we selecting a colour
 
still:
 
mov eax,23 ; wait here for event
mov ebx,1 ; for 1ms
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 check_mouse ; start loop again
 
red: ; redraw
call draw_window ; draw our window
jmp check_mouse ; start the loop again
key:
 
mov eax,2 ; get a key
int 0x40 ; do it
shr eax,8 ; move it to al
cmp byte [editstate],0 ; are we in edit mode
je check_mouse ; if not start loop again
cmp al,8 ; is it a backspace
jne no_bksp ; if no jump over backspace code
cmp byte [editpos],0 ; is it the first character
je no_del_last ; if yes jump over backspace code
dec byte [editpos] ; decrement our position
xor ebx,ebx ; clear pointer
mov bl,byte [editpos] ; get our position
add ebx,icon ; add our offset
mov byte [ebx],0 ; delete character
no_del_last:
call draw_filename ; update filename
jmp check_mouse ; start loop again
no_bksp:
cmp al,13 ; is it the enter key
jne no_enter ; no then jump over enter code
mov byte [editstate],0 ; get out of edit mode
call draw_filename ; update filename
jmp check_mouse ; start loop again
no_enter:
cmp al,31 ; are we below character 31
jbe no_lit ; then must be illegal
cmp al,97 ; are we below character 97
jb capital ; then must be ok
sub eax,32 ; else subtract 32 from it to make it legal
capital:
xor ebx,ebx ; clear our pointer
mov bl,byte [editpos] ; get our position
add ebx,icon ; add our offset
mov byte [ebx],al ; move our character into buffer
inc byte [editpos] ; increment our edit position
cmp byte [editpos],12 ; are we at our last position
jne no_null_state ; no then jump over last position code
mov byte [editstate],0 ; get out of edit mode
no_null_state:
call draw_filename ; update filename
no_lit:
jmp check_mouse ; start loop again
 
button: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jne button_3
mov eax,-1 ; close this program
int 0x40
button_3:
cmp ah,3 ; was it button 3 - FILENAME
jne button_4 ; no then try button 4
cld ;
mov byte [editstate],1 ; enter edit mode
mov edi,icon ; point to our buffer
mov eax,0x20202020 ; file reg with 4 spaces
mov ecx,3 ; going to write it 3 times
rep stosd ; repeat giving 12 spaces
mov byte [editpos],0 ; zero our edit position
call draw_filename ; update filename
jmp check_mouse ; start loop again
button_4:
cmp ah,4 ; was it button 4 - LOAD
jne button_5 ; no then try button 5
mov byte [editstate],0 ; dont want to be in edit mode
call draw_filename ; update filename
call load_file ; load the file
call draw_icon ; update icon screen
call draw_graph ; update edit screen
jmp check_mouse ; start loop again
button_5:
cmp ah,5 ; was it button 5 - SAVE
jne button_6 ; no then try button 6
mov byte [editstate],0 ; dont want to be in edit mode
call draw_filename ; update filename
call save_file ; save the file
jmp check_mouse ; start loop again
button_6:
cmp ah,6 ; was it button 6 - CLEAR ICON
jne button_7 ; no then try button 7
mov byte [editstate],0 ; dont want to be in edit mode
call draw_filename ; update filename
call clear_graph_icon ; clear the icon and edit screens
button_7:
cmp ah,7 ; was it button 7 - FLIP ICON
jne button_8 ; no then try button 8
call flip_icon ; flip
button_8:
cmp ah,8 ; was it button 8 - MIRROR ICON
jne button_9 ; no then try button 9
call flip_diag ; flip L/R and U/D
call flip_icon ; cheated now have to flip it
button_9:
cmp ah,9 ; was it button 9 - FLIP L/R and U/D
jne button_10 ; no then try button 10
call flip_diag ; flip L/R and U/D
call draw_icon ; update icon
call draw_graph ; update graph
button_10:
cmp ah,10 ; was it button 9 - SET AS BGR
jne check_mouse ; no then exit
call set_background ; set as background
 
jmp check_mouse ; start loop again
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+window_x_size ; [x start] *65536 + [x size]
mov ecx,100*65536+window_y_size ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area 0x00RRGGBB
mov esi,0x807799bb ; color of grab bar 0x00RRGGBB
mov edi,0x007799bb ; color of frames 0x00RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,7*65536+7 ; [x start] *65536 + [y start]
mov ecx,0xddeeff ; color of text 0x00RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,11 ; text length
int 0x40
; DRAW BUTTON BAR
mov eax,13 ; function 13 : draw bar
mov ebx,5*65536+window_x_size-9 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-20)*65536+16 ; [y start] *65536 + [y size]
mov edx,0x7799bb ; colour 0x00RRGGBB
int 0x40
; DEFINE BUTTON 3 : FILENAME
mov eax,8 ; function 8 : define button
mov ebx,5*65536+62 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size]
mov edx,3 ; button id number
mov esi,0x7799bb ; button color 0x00RRGGBB
int 0x40
; BUTTON 3 TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,13*65536+window_y_size-15 ; [x start] *65536 + [y start]
mov ecx,0xddeeff ; text color 0x00RRGGBB
mov edx,button_text_3 ; pointer to text beginning
mov esi,8 ; text length
int 0x40
 
call draw_filename ; update filename
 
; DEFINE BUTTON 4 : LOAD
mov eax,8 ; function 8 : define button
mov ebx,(window_x_size-87)*65536+38 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size]
mov edx,4 ; button id number
mov esi,0x7799bb ; button color 0x00RRGGBB
int 0x40
; DEFINE BUTTON 5 : SAVE
mov ebx,(window_x_size-43)*65536+38 ; [x start] *65536 + [x size]
mov edx,5 ; button id number
int 0x40
; DEFINE BUTTON 6 : CLEAR ICON
mov ebx,268*65536+72 ; [x start] *65536 + [x size]
mov ecx,65*65536+14 ; [y start] *65536 + [y size]
mov edx,6 ; button id number
int 0x40
; DEFINE BUTTON 7 : FLIP VERTICAL
mov ecx,85*65536+14 ; [y start] *65536 + [y size]
mov edx,7 ; button id number
int 0x40
; DEFINE BUTTON 8 : FLIP HORIZONTAL
mov ecx,105*65536+14 ; [y start] *65536 + [y size]
mov edx,8 ; button id number
int 0x40
; DEFINE BUTTON 9 : SET AS BACKGROUND
mov ecx,125*65536+14 ; [y start] *65536 + [y size]
mov edx,9 ; button id number
int 0x40
; DEFINE BUTTON 10 : SET AS BACKGROUND
mov ecx,145*65536+14 ; [y start] *65536 + [y size]
mov edx,10 ; button id number
int 0x40
; BUTTON 4 TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,267*65536+window_y_size-15 ; [x start] *65536 + [y start]
mov ecx,0xddeeff ; text color 0x00RRGGBB
mov edx,button_text_4 ; pointer to text beginning
mov esi,4 ; text length
int 0x40
; BUTTON 5 TEXT
mov ebx,311*65536+window_y_size-15 ; [x start] *65536 + [y start]
mov edx,button_text_5 ; pointer to text beginning
int 0x40
; BUTTON 6 TEXT
mov ebx,275*65536+69 ; [x start] *65536 + [y start]
mov edx,button_text_6 ; pointer to text beginning
mov esi,10 ; text length
int 0x40
; BUTTON 7 TEXT
mov ebx,275*65536+89 ; [x start] *65536 + [y start]
mov edx,button_text_7 ; pointer to text beginning
int 0x40
; BUTTON 8 TEXT
mov ebx,275*65536+109 ; [x start] *65536 + [y start]
mov edx,button_text_8 ; pointer to text beginning
int 0x40
; BUTTON 9 TEXT
mov ebx,275*65536+129 ; [x start] *65536 + [y start]
mov edx,button_text_9 ; pointer to text beginning
int 0x40
; BUTTON 10 TEXT
mov ebx,275*65536+149 ; [x start] *65536 + [y start]
mov edx,button_text_10 ; pointer to text beginning
int 0x40
; DRAW GRAPH BACKGROUND
mov eax,13 ; function 13 : draw bar
mov ebx,6*65536+257 ; [x start] *65536 + [x size]
mov ecx,26*65536+257 ; [y start] *65536 + [y size]
mov edx,0x7799bb ; colour 0x00RRGGBB
int 0x40
; DRAW ICON BACKGROUND
mov ebx,268*65536+34 ; [x start] *65536 + [x size]
mov ecx,26*65536+34 ; [y start] *65536 + [y size]
int 0x40
; DRAW PALETTE BACKGROUND
mov ebx,268*65536+34 ; [x start] *65536 + [x size]
mov ecx,217*65536+33 ; [y start] *65536 + [y size]
int 0x40
; DRAW PALETTE BACKGROUND
mov ebx,268*65536+33 ; [x start] *65536 + [x size]
mov ecx,250*65536+33 ; [y start] *65536 + [y size]
int 0x40
; DRAW PALETTE BACKGROUND
mov ebx,301*65536+33 ; [x start] *65536 + [x size]
mov ecx,249*65536+34 ; [y start] *65536 + [y size]
int 0x40
; DRAW GREYSCALE BACKGROUND
mov ebx,307*65536+34 ; [x start] *65536 + [x size]
mov ecx,210*65536+34 ; [y start] *65536 + [y size]
int 0x40
; DRAW SELECTED COLOUR BACKGROUND
mov ebx,268*65536+73 ; [x start] *65536 + [x size]
mov ecx,171*65536+34 ; [y start] *65536 + [y size]
int 0x40
; DRAW WHITE TO START
mov ebx,269*65536+71 ; [x start] *65536 + [x size]
mov ecx,172*65536+32 ; [y start] *65536 + [y size]
mov edx,0xffffff ; colour 0x00RRGGBB
int 0x40
; DRAW PALETTE RED + GREEN SECTION
xor edi,edi ; clear column loop count
next_r_g_outer:
xor esi,esi ; clear line loop count
next_r_g_inner:
mov eax,1 ; function 1 : putpixel
mov ebx,edi ; get column count
shr ebx,3 ; divide by 8
add ebx,269 ; add our x offset
mov ecx,esi ; get our line count
shr ecx,3 ; divide by 8
add ecx,218 ; add our y offset
mov edx,255 ; maximum red
sub edx,edi ; minus column count
shl edx,8 ; into position 0x0000RR00
add edx,255 ; maximum green
sub edx,esi ; minus line count
shl edx,8 ; into position 0x00RRGG00
int 0x40
add esi,5 ; colour in steps of 5 to keep small
cmp esi,255 ; have we done a line
jne next_r_g_inner ; nop then do next pixel
add edi,5 ; colour in steps of 5 to keep small
cmp edi,255 ; have we done all columns
jne next_r_g_outer ; no then start the next one
 
; DRAW PALETTE GREEN + BLUE SECTION
mov edi,0 ; as above
next_g_b_outer:
mov esi,0
next_g_b_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,269
mov ecx,esi
shr ecx,3
add ecx,250
mov edx,255
sub edx,edi
shl edx,16
add edx,esi
int 0x40
add esi,5
cmp esi,255
jne next_g_b_inner
add edi,5
cmp edi,255
jne next_g_b_outer
 
; DRAW PALETTE BLUE + RED SECTION
mov edi,0 ; as above
next_b_r_outer:
mov esi,0
next_b_r_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,301
mov ecx,esi
shr ecx,3
add ecx,250
mov edx,edi
shl edx,8
add edx,esi
int 0x40
add esi,5
cmp esi,255
jne next_b_r_inner
add edi,5
cmp edi,255
jne next_b_r_outer
 
; DRAW GREYSCALE
mov edi,0
next_b_w_outer:
mov esi,0
next_b_w_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,esi
shl edx,8
add edx,esi
shl edx,8
add edx,esi
int 0x40
add esi,5
cmp esi,255
jne next_b_w_inner
add edi,5
cmp edi,255
jne next_b_w_outer
 
cmp [first_run],0 ; is it the first window draw
jne dont_load ; no then dont reload the file
call load_file ; load initial file
mov [first_run],1 ; first window draw done
dont_load:
call draw_icon ; draw icon area
call draw_graph ; draw edit area
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret ; return
 
; *********************************************
; ******* SET BACKGROUND ********
; *********************************************
set_background:
 
mov ecx,image+3600 ; point to our decode buffer
mov edx,image+54+32*32*3-96 ; point to last line of bmp
 
mov edi,0 ; zero line count
decode_line:
mov esi,0 ; zero column count
decode_column:
mov ebx,[edx] ; get our data
mov [ecx],ebx ; store our data
add ecx,4 ; add 4 bytes to pointer as using double word
add edx,4 ; add 4 bytes to pointer
inc esi ; increment column count
cmp esi,24 ; have we done all columns
jne decode_column ; no then do some more
sub edx,192 ; move back 2 lines of bmp data
inc edi ; increment line count
cmp edi,33 ; have we done all lines
jne decode_line ; no then do another one
 
mov eax,15 ; background
mov ebx,1 ; set background size
mov ecx,32 ; x size
mov edx,32 ; y size
int 0x40 ; do it
mov ebx,5 ; blockmove image to os bgr memory
mov ecx,image+3600 ; point to image
mov edx,0 ; start of bgr memory
mov esi,32*32*3 ; byte count
int 0x40 ; do it
mov ebx,4 ; type of background draw
mov ecx,1 ; tile
int 0x40 ; do it
mov ebx,3 ; draw background
int 0x40 ; do it
 
ret ; return
 
; *********************************************
; ******* GET SCREEN X and Y SIZE ********
; *********************************************
get_screen_size:
 
mov eax,14 ; function 14 : get screen max
int 0x40 ; returns eax : 0xXXXXYYYY
push eax ; save reg
and eax,0x0000ffff ; split out y size
add eax,1 ; add 1 to remove zero base
mov [y_size],eax ; store for later
pop eax ; restore reg
shr eax,16 ; move x size down the reg
add eax,1 ; add 1 to remove zero base
mov [x_size],eax ; store for later
 
ret
 
; *********************************************
; ******* LOAD FILE ********
; *********************************************
load_file:
 
mov eax,6 ; function 6 : load file
mov ebx,icon ; point to the name
mov ecx,0 ; reserved
mov edx,200000 ; reserved
mov esi,image ; point to image buffer
int 0x40 ; do it
 
ret ; return
 
; *********************************************
; ******* SAVE FILE ********
; *********************************************
save_file:
 
mov eax,33 ; function 33 : save file
mov ebx,icon ; point to name
mov ecx,image ; point to our data
mov edx,54+32*32*3 ; how much data to transfer
xor esi,esi ; 0 - create a new file
int 0x40 ; do it
 
ret ; return
 
; *********************************************
; ******* DRAW FILENAME TO SCREEN ********
; *********************************************
draw_filename:
; DRAW COLOUR BACKGROUND
pusha ; save all registers on stack
mov eax,13 ; function 13 : draw bar
mov ebx,73*65536+81 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-19)*65536+15 ; [y start] *65536 + [y size]
mov edx,0x557799 ; colour 0x00RRGGBB
int 0x40
 
mov eax,4 ; function 4 : write text to window
mov ebx,78*65536+(window_y_size-15) ; [y start] *65536 + [y size]
xor ecx,ecx ; colour 0x00RRGGBB = black
mov edx,icon ; point to text
mov esi,12 ; number of characters to write
cmp byte [editstate],1 ; are we in edit mode
jne no_active_1 ; no then jump over change colour
mov ecx,0x00112299 ; else change colour
no_active_1:
int 0x40 ; do it
popa ; return all registers to original
ret ; return
 
; *********************************************
; ******* DRAW ICON FROM LOADED FILE ********
; *********************************************
draw_icon:
 
mov ecx,27 ; y start position
mov eax,image+51+32*32*3 ; point to our bmp data
mov edi,0 ; line count
line:
mov esi,0 ; column count
mov ebx,269+31 ; x start position
pixel:
mov edx,[eax] ; colour 0x00RRGGBB from image data
push eax ; save our position
mov eax,1 ; function 1 : put pixel
int 0x40 ; do it
pop eax ; restore our position
sub eax,3 ; point to next pixel colour
dec ebx ; move our x position
inc esi ; increment our column count
cmp esi,32 ; have we done all columns
jne pixel ; no then do next pixel
inc ecx ; move our y position
inc edi ; increment line count
cmp edi,32 ; have we done all lines
jne line ; no then do next line
 
ret ; return
 
; *********************************************
; ******* DRAW GRAPH FROM LOADED FILE *******
; *********************************************
draw_graph:
 
mov edi,0 ; line count
mov eax,image+51+32*32*3 ; point to our bmp data
next_lin:
mov ecx,edi ; use our line count for position
shl ecx,3 ; multiply by eight
add ecx,27 ; add y start position
shl ecx,16 ; move into top eight bytes [y start]
add ecx,7 ; add box height [y size]
mov esi,32 ; column count
next_bo:
mov ebx,esi ; use our column count for position
shl ebx,3 ; multiply by eight
add ebx,-1 ; add a correction
shl ebx,16 ; and move into top eight bytes [x start]
add ebx,7 ; add box width [x size]
mov edx,[eax] ; point to bmp data
push eax ; save our position
mov eax,13 ; function 13 : draw bar
int 0x40 ; do it
pop eax ; restore our position
sub eax,3 ; point to next pixel colour
dec esi ; increment column count
cmp esi,0 ; have we done all columns
jne next_bo ; no then do the next column
inc edi ; increment line count
cmp edi,32 ; have we done all lines
jne next_lin ; no then do the next line
 
ret ; return
 
; *********************************************
; ******* CLEAR GRAPH and ICON AREA ********
; *********************************************
clear_graph_icon:
 
; CLEAR IMAGE DATA
mov edi,image+54 ; point to our data
mov eax,0x00000000 ; data to write
mov ecx,(32*32*3)/4 ; how much data
rep stosd ; repeat until all data transfered
call draw_icon ; draw a blank icon
call draw_graph ; draw a blank graph
 
ret ; return
 
; *********************************************
; ******* FLIP ICON TOP to BOTTOM ********
; *********************************************
flip_icon:
 
mov ecx,image+54 ; point at first line
mov edx,image+54+32*32*3+96 ; point 1 line past end
 
mov edi,0 ; zero line count
lines:
mov esi,0 ; zero column count
sub edx,192 ; move back 2 lines
columns:
mov eax,[ecx] ; get bytes
mov ebx,[edx] ; get bytes
mov [ecx],ebx ; swap bytes
mov [edx],eax ; swap bytes
add ecx,4 ; move pointer
add edx,4 ; move pointer
inc esi ; increment column count
cmp esi,24 ; have we done all columns
jne columns ; no then do next column
inc edi ; increment line count
cmp edi,16 ; have we done all lines
jne lines ; no then do next line
call draw_icon ; update icon
call draw_graph ; update graph
 
ret ; return
 
; *********************************************
; ******* FLIP ICON DIAGONAL ********
; *********************************************
flip_diag:
 
mov ecx,image+54 ; point line 1 first bytes
mov edx,image+3600 ; point to buffer
xor esi,esi ; zero byte count
 
pusha ; save all registers
copy_out:
mov eax,[ecx] ; get bytes
mov [edx],eax ; copy bytes
add ecx,4 ; move pointer
add edx,4 ; move pointer
inc esi ; increment byte count
cmp esi,24*32 ; have we done all bytes
jne copy_out ; no then do the next
popa ; restore all registers
 
mov edx,image+3600+32*32*3-3 ; point to last bytes
copy_in:
mov eax,[edx] ; get bytes
mov [ecx],eax ; copy to image first bytes
add ecx,3 ; move pointer 3 bytes
sub edx,3 ; move pointer 3 bytes
inc esi ; increment byte count
cmp esi,32*32 ; have we done all bytes
jne copy_in ; no then do next
 
ret ; return
 
; *********************************************
; ******* DRAW MOUSE ON GRAPH / ICON ********
; *********************************************
draw_mouse:
 
mov eax,37 ; function 37
mov ebx,2 ; sub function 2 : check for mouse button
int 0x40 ; do it
cmp eax,0 ; was a button pressed
je exit_mouse ; no then jump to exit
cmp eax,1 ; left hand button
je colour_mouse ; we are using selected colour
mov [draw_colour],0x000000 ; else draw with black
jmp blank ; jmp over colour select
colour_mouse:
mov eax,[sel_colour] ; get our selected colour
mov [draw_colour],eax ; save our selected colour
blank:
mov eax,37 ; function 37
mov ebx,1 ; sub function 1 : get mouse position
int 0x40 ; do it
push eax ; save our x/y position for later
and eax,0x0000ffff ; y is in lower bytes
add eax,1 ; add 1 because we are zero based
mov [my_pos],eax ; save y position
pop eax ; restore our x/y position
shr eax,16 ; shift x into lower bytes
add eax,1 ; add 1 because we are zero based
mov [mx_pos],eax ; save x position
cmp [mx_pos],7 ; check we are within x/y limits
jle exit_mouse
cmp [mx_pos],263
jge exit_mouse
cmp [my_pos],27
jle exit_mouse
cmp [my_pos],283
jge exit_mouse
mov eax,[mx_pos] ; calculate nearest square and save
sub eax,7 ; subtract 7 graph zero offset
shr eax,3 ; divide by 8 (box size) loose remainder
mov [icon_x],eax ; save for use later in icon
shl eax,3 ; multiply by 8 to get box position
add eax,7 ; add 7 graph zero offset
mov [gx_pos],eax ; save graph x position
mov eax,[my_pos] ; repeat for y
sub eax,27 ;
shr eax,3 ;
mov [icon_y],eax ;
shl eax,3 ;
add eax,27 ;
mov [gy_pos],eax ;
mov eax,13 ; function 13 : draw bar
mov ebx,[gx_pos] ; load graph x position
shl ebx,16 ; shift into high bytes
add ebx,7 ; add box size
mov ecx,[gy_pos] ; repeat for y
shl ecx,16 ;
add ecx,7 ;
mov edx,[draw_colour] ; give it a colour
int 0x40 ; do it
mov eax,1 ; function 1 : put pixel
mov ebx,[icon_x] ; icon x from above
add ebx,269 ; add icon x offset
mov ecx,[icon_y] ; icon y from above
add ecx,27 ; add icon y offset
mov edx,[draw_colour] ; give it a colour
int 0x40 ; do it
mov ecx,image+54 ; point to our data
mov ebx,31 ; 32 lines in image zero based
sub ebx,[icon_y] ; get the correct line
mov eax,96 ; 96 or 3 bytes per colour * 32 columns
mul ebx ; multiply by 96 result in eax
add ecx,eax ; add to our position
mov ebx,[icon_x] ; get the correct column
mov eax,3 ; 3 bytes per colour
mul ebx ; multiply by 3 result in eax
add ecx,eax ; add to our position
mov ebx,[draw_colour] ; get our colour
mov [ecx],bl ; move blue into image data
mov [ecx+1],bh ; move green into image data
shr ebx,16 ; shift red down
mov [ecx+2],bl ; move red into image data
exit_mouse:
 
ret ; return
 
; *********************************************
; ******* GET COLOUR TO DRAW WITH ********
; *********************************************
check_colour:
 
mov eax,37 ; function 37
mov ebx,2 ; sub function 2 : check for mouse button
int 0x40 ; do it
cmp eax,0 ; was a button pressed
je exit_draw ; no then jump to exit
mov eax,37 ; function 37
mov ebx,1 ; sub function 1 : get mouse position
int 0x40 ; do it
push eax ; save our x/y position for later
and eax,0x0000ffff ; y is in lower bytes
add eax,1 ; add 1 because we are zero based
mov [my_pos],eax ; save y position
pop eax ; restore our x/y position
shr eax,16 ; shift x into lower bytes
add eax,1 ; add 1 because we are zero based
mov [mx_pos],eax ; save x position
cmp [mx_pos],270 ; check we are within x/y limits
jl check_rb
cmp [mx_pos],301
jg check_rb
cmp [my_pos],219
jl check_rb
cmp [my_pos],250
jg check_rb
 
call decode_mouse
 
mov edi,0
next_sel_rg_outer:
mov esi,0
next_sel_rg_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,[sel_colour]
add edx,esi
int 0x40
add esi,5
cmp esi,255
jne next_sel_rg_inner
add edi,5
cmp edi,255
jne next_sel_rg_outer
 
 
check_rb:
 
cmp [mx_pos],270 ; check we are within x/y limits
jl check_bg
cmp [mx_pos],301
jg check_bg
cmp [my_pos],251
jle check_bg
cmp [my_pos],282
jg check_bg
 
call decode_mouse
 
mov edi,0
next_sel_rb_outer:
mov esi,0
next_sel_rb_inner:
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,[sel_colour]
mov eax,esi
shl eax,8
add edx,eax
mov eax,1
int 0x40
add esi,5
cmp esi,255
jne next_sel_rb_inner
add edi,5
cmp edi,255
jne next_sel_rb_outer
 
 
check_bg:
 
cmp [mx_pos],301 ; check we are within x/y limits
jl get_colour
cmp [mx_pos],333
jg get_colour
cmp [my_pos],251
jl get_colour
cmp [my_pos],282
jg get_colour
 
call decode_mouse
 
mov edi,0
next_sel_bg_outer:
mov esi,0
next_sel_bg_inner:
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,[sel_colour]
mov eax,esi
shl eax,16
add edx,eax
mov eax,1
int 0x40
add esi,5
cmp esi,255
jne next_sel_bg_inner
add edi,5
cmp edi,255
jne next_sel_bg_outer
 
get_colour:
 
cmp [mx_pos],309 ; check we are within x/y limits
jl exit_draw
cmp [mx_pos],340
jg exit_draw
cmp [my_pos],212
jl exit_draw
cmp [my_pos],243
jg exit_draw
 
call decode_mouse
 
mov eax,13
mov ebx,269*65536+71
mov ecx,172*65536+32
mov edx,[sel_colour]
int 0x40
 
mov eax,[sel_colour]
mov [draw_colour],eax
 
mov eax,47
xor ebx,ebx
mov ebx,6
shl ebx,16
mov bh,1
mov ecx,[sel_colour]
mov edx,273*65536+176
mov esi,0x000000
int 0x40
 
exit_draw:
 
ret
 
; *********************************************
; ******* DECODE MOUSE POSITION GET PIX *****
; *********************************************
 
decode_mouse:
 
mov eax,37
xor ebx,ebx
int 0x40
mov ebx,eax
mov ecx,eax
and ebx,0xffff0000
shr ebx,16
and ecx,0x0000ffff
mov eax,[x_size]
imul ecx,eax
add ebx,ecx
mov eax,35
dec ebx
int 0x40
 
mov [sel_colour],eax
 
ret
 
; *********************************************
; ******* DATA AREA *****
; *********************************************
 
mx_pos dd 0x0
my_pos dd 0x0
 
gx_pos dd 0x0
gy_pos dd 0x0
 
icon_x dd 0x0
icon_y dd 0x0
 
x_size dd 0x0
y_size dd 0x0
 
sel_colour dd 0x00ffffff
draw_colour dd 0x00ffffff
 
button_text_3 db 'FILENAME'
button_text_4 db 'LOAD'
button_text_5 db 'SAVE'
button_text_6 db 'CLEAR ICON'
button_text_7 db 'FLIP VERT '
button_text_8 db 'FLIP HORIZ'
button_text_9 db 'FLIP DIAG '
button_text_10 db 'SET AS BGR'
 
labelt: db 'ICON EDITOR'
 
icon: db 'WRITE.BMP '
 
editpos db 0
editstate db 0
 
first_run db 0
 
image:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/iconedit/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/iconmngr/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm iconmngr.asm iconmngr
@pause
/programs/iconmngr/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm iconmngr.asm iconmngr
@pause
/programs/iconmngr/trunk/iconmngr.asm
0,0 → 1,726
;********************************
;* *
;* DESKTOP ICON MANAGER *
;* *
;* Compile with flat assembler *
;* *
;********************************
; 22.02.05 was modified for work with new multi-thread ICON.
;******************************************************************************
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
dd 0x2000 ; esp
dd I_Param , 0x0 ; I_Param , I_Icon
include 'lang.inc'
include 'macros.inc'
;******************************************************************************
 
START: ; start of execution
 
call load_icon_list
 
call check_parameters
 
red:
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
 
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:
 
cmp eax,11
jb no_str
cmp eax,13
jg no_str
call read_string
jmp still
no_str:
 
 
cmp eax,21 ; apply changes
jne no_apply
 
; (1) save list
 
mov eax,33
mov ebx,icon_lst
mov ecx,icon_data
mov edx,52
imul edx,dword [icons]
mov esi,0
int 0x40
 
 
; (2) terminate all icons
 
mov esi,1
newread:
inc esi
mov eax,9
mov ebx,I_END
mov ecx,esi
int 0x40
cmp esi,eax
jg all_terminated
 
cmp [I_END+10],dword 'ICON'
jne newread
cmp [I_END+14],dword ' '
jne newread
 
mov eax,18
mov ebx,2
mov ecx,esi
int 0x40
 
; mov eax,5
; mov ebx,5
; int 0x40
 
mov esi,1
 
jmp newread
 
all_terminated:
 
apply_changes:
 
mov eax,19
mov ebx,icon_name
mov ecx,icon_start_parameters
int 0x40
 
; mov eax,5
; mov ebx,3
; int 0x40
 
jmp still
 
; mov eax,-1
; int 0x40
 
no_apply:
 
 
cmp eax,22 ; user pressed the 'add icon' button
jne no_add_icon
 
mov eax,13
mov ebx,24*65536+270
mov ecx,250*65536+10
mov edx,0xffffff
int 0x40
mov eax,4
mov ebx,24*65536+250
mov ecx,0xff0000
mov edx,add_text
mov esi,add_text_len-add_text
int 0x40
 
mov eax,10
int 0x40
cmp eax,3
jne still
mov eax,17
int 0x40
shr eax,8
cmp eax,40
jb no_f
sub eax,40
 
xor edx,edx ; bcd -> 10
mov ebx,16
div ebx
imul eax,10
add eax,edx
 
mov ebx,eax
add ebx,icons_reserved
cmp [ebx],byte 'x'
je no_f
mov [ebx],byte 'x'
 
xor edx,edx
mov ebx,10
div ebx
add eax,65
add edx,65
mov [icon_default+0],dl
mov [icon_default+1],al
 
inc dword [icons]
mov edi,[icons]
dec edi
imul edi,52
add edi,icon_data
 
mov [current_icon],edi
 
mov esi,icon_default
mov ecx,52
cld
rep movsb
 
no_f:
 
call draw_window
 
jmp still
 
no_add_icon:
 
 
cmp eax,23 ; user pressed the remove icon button
jne no_remove_icon
 
mov eax,13
mov ebx,24*65536+270
mov ecx,250*65536+10
mov edx,0xffffff
int 0x40
mov eax,4
mov ebx,24*65536+250
mov ecx,0xff0000
mov edx,rem_text
mov esi,rem_text_len-rem_text
int 0x40
 
mov eax,10
int 0x40
cmp eax,3
jne no_found
mov eax,17
int 0x40
shr eax,8
cmp eax,40
jb no_found
sub eax,40
 
xor edx,edx
mov ebx,16
div ebx
imul eax,10
add eax,edx
 
mov ebx,eax
add ebx,icons_reserved
cmp [ebx],byte 'x'
jne no_found
mov [ebx],byte ' '
 
xor edx,edx
mov ebx,10
div ebx
shl eax,8
mov al,dl
 
add eax,65*256+65
 
mov esi,icon_data
mov edi,52
imul edi,[icons]
add edi,icon_data
news:
cmp word [esi],ax
je foundi
add esi,52
cmp esi,edi
jb news
jmp no_found
 
foundi:
 
mov ecx,edi
sub ecx,esi
 
mov edi,esi
add esi,52
 
cld
rep movsb
 
dec [icons]
 
mov eax,icon_data
mov [current_icon],eax
 
no_found:
 
call draw_window
 
jmp still
 
 
 
no_remove_icon:
 
 
cmp eax,40 ; user pressed button for icon position
jb no_on_screen_button
 
sub eax,40
mov edx,eax
shl eax,4
and edx,0xf
mov dh,ah
add edx,65*256+65
 
mov esi,icon_data
mov ecx,[icons]
cld
findl1:
cmp dx,[esi]
je foundl1
add esi,50+2
loop findl1
jmp still
 
foundl1:
 
mov [current_icon],esi
 
call print_strings
 
jmp still
 
no_on_screen_button:
 
 
jmp still
 
 
current_icon dd icon_data
 
 
print_strings:
 
pusha
 
mov eax,13 ; clear text area
mov ebx,100*65536+100
mov ecx,278*65536+40
mov edx,0xffffff
int 0x40
 
mov eax,4 ; icon text
mov ebx,100*65536+278
mov ecx,0x000000
mov edx,[current_icon]
add edx,33
mov esi,12
int 0x40
 
mov eax,4 ; icon application
add ebx,14
mov edx,[current_icon]
add edx,19
mov esi,12
int 0x40
 
mov eax,4 ; icon bmp
add ebx,14
mov edx,[current_icon]
add edx,5
mov esi,12
int 0x40
 
popa
 
ret
 
 
icon_lst db 'ICON LST'
 
load_icon_list:
 
 
pusha
 
mov eax,6
mov ebx,icon_lst
mov ecx,0
mov edx,-1
mov esi,icon_data
int 0x40
 
add eax,10
xor edx,edx
mov ebx,52
div ebx
mov [icons],eax
 
mov edi,icons_reserved ; clear reserved area
mov eax,32
mov ecx,10*10
cld
rep stosb
 
mov ecx,[icons] ; set used icons to reserved area
mov esi,icon_data
cld
ldl1:
movzx ebx,byte [esi+1]
sub ebx,65
imul ebx,10
movzx eax,byte [esi]
add ebx,eax
sub ebx,65
add ebx,icons_reserved
mov [ebx],byte 'x'
add esi,50+2
loop ldl1
 
popa
 
ret
 
 
check_parameters:
 
cmp [I_Param],dword 'BOOT'
je chpl1
ret
chpl1:
 
mov eax,21
jmp apply_changes
 
 
positions dd 33,19,5
 
read_string:
 
pusha
 
sub eax,11
shl eax,2
add eax,positions
mov eax,[eax]
 
mov esi,[current_icon]
add esi,eax
mov [addr],esi
 
mov edi,[addr]
mov eax,'_'
mov ecx,12
cld
rep stosb
 
call print_strings
 
mov edi,[addr]
f11:
mov eax,10
int 0x40
cmp eax,2
jz fbu
jmp rs_done
fbu:
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je rs_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
dec edi
mov [edi],byte '_'
call print_strings
jmp f11
nobsl:
cmp eax,31
jbe f11
cmp eax,97
jb keyok
sub eax,32
keyok:
mov [edi],al
call print_strings
 
add edi,1
mov esi,[addr]
add esi,12
cmp esi,edi
jnz f11
 
rs_done:
 
mov ecx,[addr]
add ecx,12
sub ecx,edi
mov eax,32
cld
rep stosb
 
call print_strings
 
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
mov ebx,210*65536+300
mov ecx,30*65536+390
mov edx,0x03ffffff
mov esi,0x808899ff
mov edi,0x008899ff
int 0x40
 
; WINDOW LABEL
mov eax,4
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
 
mov eax,13 ; WINDOW AREA
mov ebx,20*65536+260
mov ecx,35*65536+200
mov edx,0x3366cc
int 0x40
 
mov eax,38 ; VERTICAL LINE ON WINDOW AREA
mov ebx,150*65536+150
mov ecx,35*65536+235
mov edx,0xffffff
int 0x40
 
mov eax,38 ; HOROZONTAL LINE ON WINDOW AREA
mov ebx,20*65536+280
mov ecx,135*65536+135
mov edx,0xffffff
int 0x40
 
mov eax,8 ; TEXT ENTER BUTTONS
mov ebx,20*65536+72
mov ecx,275*65536+13
mov edx,11
mov esi,[bcolor]
int 0x40
inc edx
add ecx,14*65536
mov eax,8
int 0x40
inc edx
add ecx,14*65536
mov eax,8
int 0x40
 
mov eax,8 ; APPLY AND SAVE CHANGES BUTTON
mov ebx,20*65536+259
mov ecx,329*65536+15
mov edx,21
mov esi,[bcolor]
int 0x40
 
mov eax,8 ; ADD ICON BUTTON
mov ebx,20*65536+129
add ecx,14*2*65536
inc edx
int 0x40
 
mov eax,8 ; REMOVE ICON BUTTON
add ebx,130*65536
inc edx
int 0x40
 
mov eax,0 ; DRAW BUTTONS ON WINDOW AREA
mov ebx,20*65536+25
mov ecx,35*65536+19
mov edi,icon_table
mov edx,40
newbline:
 
cmp [edi],byte 'x'
jne no_button
 
mov esi,0x5577cc
cmp [edi+100],byte 'x'
jne nores
mov esi,0xcc5555
nores:
 
push eax
mov eax,8
int 0x40
pop eax
 
no_button:
 
add ebx,26*65536
 
inc edi
inc edx
 
inc al
cmp al,9
jbe newbline
mov al,0
 
add edx,6
 
ror ebx,16
mov bx,20
ror ebx,16
add ecx,20*65536
 
inc ah
cmp ah,9
jbe newbline
 
mov ebx,24*65536+250
mov ecx,0xffffff
mov edx,text
mov esi,47
newline:
mov ecx,[edx]
add edx,4
mov eax,4
int 0x40
add ebx,14
add edx,47
cmp [edx],byte 'x'
jne newline
 
call print_strings
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
; DATA AREA
 
 
str1 db ' '
str2 db ' '
 
bcolor dd 0x335599
 
icon_table:
 
times 4 db 'xxxx xxxx'
times 2 db ' '
times 1 db ' '
times 2 db 'xxxx xxxx'
times 1 db ' '
 
icons_reserved:
 
times 10 db ' '
 
if lang eq ru
text:
db 0,0,0,0, '€†Œˆ’… € Ž‡ˆ–ˆž ˆŠŽŠˆ „‹Ÿ …„€Š’ˆŽ‚€ˆŸ '
db 0,0,0,0, ' '
db 255,255,255,0, ' ’…Š‘’ '
db 255,255,255,0, ' Žƒ€ŒŒ€ '
db 255,255,255,0, ' ‚Œ ”€‰‹ '
db 0,0,0,0, ' '
db 255,255,255,0, ' ˆŒ…ˆ’œ '
db 0,0,0,0, ' '
db 255,255,255,0, ' „Ž€‚ˆ’œ “„€‹ˆ’œ '
db 'x' ; <- END MARKER, DONT DELETE
 
labelt:
db ' áâனª  à ¡®ç¥£® á⮫ '
labellen:
else
text:
db 0,0,0,0, 'CLICK ON THE UNUSED ICON POSITION TO EDIT '
db 0,0,0,0, ' '
db 255,255,255,0, ' ’…Š‘’ '
db 255,255,255,0, ' Žƒ€ŒŒ€ '
db 255,255,255,0, ' ‚Œ ”€‰‹ '
db 0,0,0,0, ' '
db 255,255,255,0, ' ˆŒ…ˆ’œ '
db 0,0,0,0, ' '
db 255,255,255,0, ' „Ž€‚ˆ’œ “„€‹ˆ’œ '
db 'x' ; <- END MARKER, DONT DELETE
 
labelt:
db ' áâனª  à ¡®ç¥£® á⮫ '
labellen:
end if
 
icons dd 0
 
addr dd 0
ya dd 0
 
add_text db '€†Œˆ’… € Ž‡ˆ–ˆž …ˆ‘Ž‹œ‡“…ŒŽ‰ ˆŠŽŠˆ'
add_text_len:
 
rem_text db '€†Œˆ’… € Ž‡ˆ–ˆž ˆ‘Ž‹œ‡“…ŒŽ‰ ˆŠŽŠˆ'
rem_text_len:
 
icon_name:
db 'ICON '
 
icon_start_parameters:
db 25,1,1,1
db 35,1,1,1
db 'WRITE BMP'
db 'EDITOR '
db 'EDITOR ',0,0
 
icon_default:
db 'AA - TIP.BMP - SETUP - SETUP *',13,10
 
I_Param:
 
icon_data = I_END+256
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/iconmngr/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ipc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm ipc.asm ipc
@pause
/programs/ipc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ipc.asm ipc
@pause
/programs/ipc/trunk/ipc.asm
0,0 → 1,424
;
; Example for Inter Process Communication
;
; 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 0x60000 ; memory for app
dd 0x60000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
START: ; start of execution
 
 
mov eax,60 ; IPC
mov ebx,1 ; define receive area
mov ecx,received_messages ; pointer to start
mov edx,1000 ; size of area
int 0x40
 
mov eax,40 ; WANTED EVENTS
mov ebx,01000111b ; IPC 7 + defaults
int 0x40
 
mov [received_messages+8],dword 0*256+0
mov [received_messages+12],dword 0
 
call draw_window ; at first, draw the window
 
still:
 
mov eax,23 ; wait here for event
mov ebx,50
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
cmp eax,7 ; IPC ?
jne no_ipc
call display_ipc_messages
jmp still
no_ipc:
 
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_read
call read_string
 
movzx eax,byte [message]
sub eax,48
imul eax,10
movzx ebx,byte [message+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [message+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [message+3]
add eax,ebx
sub eax,48
 
mov [PID],eax
 
mov eax,60 ; IPC
mov ebx,2 ; send message
mov ecx,[PID]
mov edx,message+4
mov esi,20;[message_size]
int 0x40
 
jmp still
no_read:
 
 
cmp ah,3
jne no_messages_pop ; pop the first out
call ipc_message_pop
jmp still
no_messages_pop:
 
jmp still
 
 
ipc_message_pop:
 
pusha
 
cmp [received_messages+4],dword 8
je already_empty
 
mov [received_messages],byte 1 ; lock the area
 
push dword [received_messages+4]
 
mov ecx,[received_messages+12]
 
sub [received_messages+4],ecx
sub [received_messages+4],dword 8
 
mov edi,received_messages+8
mov esi,edi
add esi,ecx
add esi,8
 
pop ecx
 
cld
rep movsb
 
call display_ipc_messages
 
mov [received_messages],byte 0 ; free the area
 
already_empty:
 
popa
ret
 
 
 
display_ipc_messages:
 
pusha
 
mov eax,13
mov ebx,25*65536+245
mov ecx,105*65536+90
mov edx,0xdddddd
int 0x40
 
cmp [received_messages+4],dword 8 ; empty list
je ipma1
 
mov ebx,25*65536+105 ; draw info text with function 4
mov ecx,0x224466
mov edx,received_messages+8
mov esi,40
mov [counter],0
newline2:
pusha
mov ecx,[edx]
and ecx,0xfff
mov edx,ebx
mov eax,47
mov ebx,4*65536
mov esi,0xff0000
int 0x40
popa
pusha
mov esi,20
add edx,8
add ebx,30*65536
mov eax,4
int 0x40
popa
 
add ebx,10
mov edi,[edx+4]
add edi,8
and edi,0xfff
add edx,edi
 
mov edi,[received_messages+4]
add edi,received_messages
cmp edx,edi
jge ipma1
 
inc [counter]
cmp [counter],8
jbe newline2
 
ipma1:
 
popa
ret
 
 
counter dd 0x0
 
 
; *********************************************
; ******* 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+290 ; [x start] *65536 + [x size]
mov ecx,100*65536+220 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; 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 ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
mov eax,9
mov ebx,process_info
mov ecx,-1
int 0x40
 
mov eax,47
mov ebx,4*65536
mov ecx,[process_info+30]
mov edx,180*65536+35
mov esi,0x000000
int 0x40
 
mov eax,8 ; MESSAGE
mov ebx,25*65536+87
mov ecx,50*65536+16
mov edx,2
mov esi,0x5588dd
int 0x40
 
mov eax,8 ; POP
mov ebx,216*65536+53
mov ecx,80*65536+16
mov edx,3
mov esi,0x5588dd
int 0x40
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0x224466
mov edx,text
mov esi,40
newline:
mov eax,4
int 0x40
add ebx,10
add edx,40
cmp [edx],byte 'x'
jne newline
 
call display_ipc_messages
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
 
 
read_string:
 
pusha
 
mov [addr],dword message
mov [ya],55
mov [xa],120
 
mov ecx,20
mov edi,[addr]
mov al,' '
cld
rep stosb
 
call print_text
 
mov edi,[addr]
 
f11:
mov eax,10
int 0x40
cmp eax,2
jz fbu
 
exit_readkey:
 
popa
ret
 
fbu:
mov eax,2
int 0x40 ; get key
shr eax,8
 
cmp eax,13
je exit_readkey
 
cmp eax,8
jnz nobs
cmp edi,[addr]
jz f11
dec edi
mov [edi],byte ' '
call print_text
jmp f11
nobs:
 
cmp eax,31
jbe f11
cmp eax,95
jb keyok
sub eax,32
keyok:
mov [edi],al
 
call print_text
 
inc edi
mov esi,[addr]
add esi,20
cmp esi,edi
jnz f11
 
popa
ret
 
 
 
print_text:
 
mov eax,13
mov ebx,[xa]
shl ebx,16
add ebx,25*6
mov ecx,[ya]
shl ecx,16
mov cx,8
mov edx,0xffffff
int 0x40
 
mov eax,4
mov ebx,[xa]
shl ebx,16
add ebx,[ya]
mov ecx,0x000000
mov edx,[addr]
mov esi,25
int 0x40
 
ret
 
 
 
 
 
 
; DATA AREA
 
ya dd 0x0
xa dd 0x0
addr dd 0x0
 
text:
db 'PROCESS ID FOR THIS APP : '
db ' '
db ' PID:MESSAGE 0130 EXAMPLE MESSAGE '
db ' '
db ' '
db 'RECEIVED: POP '
db 'x' ; <- END MARKER, DONT DELETE
 
 
labelt:
db 'IPC - START AT LEAST 2'
labellen:
 
I_END:
 
PID: dd 0x0
message_size: dd 20
 
received_messages:
 
db 0 ; lock byte
db 0,0,0 ; reserved
dd 8 ; pointer to free msg position from received_messages
 
; Sender PID
; Msg length
; Msg data
 
rb 0x1000
message: times 70 db ?
process_info: times 256 dd ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ipc/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ir/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm ir.asm ir
@pause
/programs/ir/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ir.asm ir
@pause
/programs/ir/trunk/ir.asm
0,0 → 1,333
;
; INFRARED
;
; Compile with FASM for Menuet
;
 
use32
 
org 0x0
 
db 'MENUET00' ; 8 byte id
dd 56 ; 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 draw_window ; at first, draw the window
 
call set_variables
 
still:
 
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
cmp eax,16+4
je readir
 
jmp still
 
pos dd 0x0
 
cdplayer db 'CDPLAY '
 
readir:
mov eax,42
mov ebx,4
int 0x40
 
cmp ebx,80
jne nocd
 
mov eax,19
mov ebx,cdplayer
mov ecx,0
int 0x40
 
 
nocd:
 
push ebx
mov eax,[pos]
add eax,1
cmp eax,10*20+1
jb noeaxz
mov esi,text+10*4
mov edi,text
mov ecx,10*21*4
cld
rep movsb
mov eax,13
mov ebx,20*65536+260
mov ecx,22*65536+220
mov edx,[wcolor]
int 0x40
mov eax,10*19+1
noeaxz:
mov [pos],eax
pop ebx
and ebx,0xff
call draw_data
jmp still
 
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,45 ; free irq
mov ebx,1
mov ecx,4
int 0x40
 
mov eax,46 ; free ports 0x3f0-0x3ff
mov ebx,1
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
 
mov eax,-1 ; close this program
int 0x40
noclose:
 
jmp still
 
 
 
draw_data:
 
pusha
 
xchg eax,ebx
 
mov ecx,10
shl ebx,2
mov esi,3
newnum:
xor edx,edx
div ecx
add edx,48
mov [ebx+text-1],dl
dec ebx
dec esi
jnz newnum
 
call draw_text
 
popa
 
ret
 
 
irqtable:
 
dd 0x3f8+0x01000000 ; + 01 = read byte, 02 read word
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
 
 
 
set_variables:
 
 
pusha
 
mov eax,46 ; reserve ports 0x3f0 - 0x3ff
mov ebx,0
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
 
mov eax,45 ; reserve irq 4
mov ebx,0
mov ecx,4
int 0x40
 
mov eax,46 ; reserve ports 0x3f0-0x3ff
mov ebx,0
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
 
mov eax,44 ; set read ports for irq 4
mov ebx,irqtable
mov ecx,4
int 0x40
 
mov cx,0x3f3+8
mov bl,0x80
mov eax,43
int 0x40
 
mov cx,0x3f1+8
mov bl,0
mov eax,43
int 0x40
 
mov cx,0x3f0+8
mov bl,0x30 / 4
mov eax,43
int 0x40
 
mov cx,0x3f3+8
mov bl,3
mov eax,43
int 0x40
 
mov cx,0x3f4+8
mov bl,0xB
mov eax,43
int 0x40
 
mov cx,0x3f1+8
mov bl,1
mov eax,43
int 0x40
 
mov eax,5
mov ebx,100
int 0x40
 
mov cx,0x3f8
mov bl,'I'
mov eax,43
int 0x40
 
mov eax,5
mov ebx,10
int 0x40
 
mov cx,0x3f8
mov bl,'R'
mov eax,43
int 0x40
 
mov eax,40 ; get com 1 data with irq 4
mov ebx,0000000000010000b shl 16 + 111b
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,100*65536+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+250 ; [y start] *65536 + [y size]
mov edx,[wcolor] ; color of work area RRGGBB,8->color
mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide
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
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x5599cc ; button color RRGGBB
; int 0x40
 
call draw_text
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
draw_text:
 
pusha
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0xffffff
mov edx,text
mov esi,40
mov edi,20
newline:
mov eax,4
int 0x40
add ebx,10
add edx,40
dec edi
jne newline
 
popa
 
ret
 
 
 
; DATA AREA
 
wcolor dd 0x03000000
 
labelt db 'INFRARED RECEIVER FOR IRMAN IN COM 1'
labellen:
 
text:
 
I_END:
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ir/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/jpegview/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm jpegview.asm jpegview
@pause
/programs/jpegview/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm jpegview.asm jpegview
@pause
/programs/jpegview/trunk/filelib.asm
0,0 → 1,151
file_handler:
.position=0
.size=4
.bufer_block=8
.operation=12
.first_block=16
.n_blocks=20
.bufer=24
.work_area=28
.name=32
.st_size=32+128
 
open: ;esi=name_string
;retorna eax
pushad
push dword [work_area]
mov ecx,512 ;bufer
call malloc
push edi
mov ecx,file_handler.st_size
call mallocz
pop dword[edi+file_handler.bufer]
pop dword[edi+file_handler.work_area]
mov [esp+28],edi
mov ecx,100
add edi,file_handler.name
call movedata
mov edi,[esp+28]
mov byte[edi+file_handler.n_blocks],1
mov eax,58
lea ebx,[edi+file_handler.operation]
push edi
int 0x40
pop edi
test eax,eax
jnz close.b
mov [edi+file_handler.size],ebx
clc
popad
ret
 
close:
pushad
.b:
mov eax,[esp+28]
mov edi,[eax+file_handler.bufer]
call free
mov edi,eax
call free
popad
xor eax,eax
ret
 
 
read: ;(f,bufer,nbytes) eax,edi,ecx ncr
;retorna bytes leidos en ecx
pushad
mov edx,[eax+file_handler.size]
sub edx,[eax+file_handler.position]
cmp edx,ecx
jnc .nb_ok
mov ecx,edx
mov [esp+24],edx
.nb_ok:
jecxz .final
mov byte[eax+file_handler.operation],0
test dword[eax+file_handler.position],511
jz .l1
call .bufer
.l1:
mov edx,ecx
shr edx,9
jz .l2
mov [eax+file_handler.n_blocks],edx
mov edx,[eax+file_handler.position]
shr edx,9
mov [eax+file_handler.first_block],edx
xchg edi,[eax+file_handler.bufer]
pushad
lea ebx,[eax+file_handler.operation]
mov eax,58
int 40h
cmp eax,0ffffff00h
jnc .error
popad
xchg edi,[eax+file_handler.bufer]
mov edx,ecx
and edx,0fffffe00h
add [eax+file_handler.position],edx
add edi,edx
.l2:
and ecx,511
jz .final
call .bufer
.final:
popad
ret
 
.bufer:
pushad
mov ebx,[eax+file_handler.position]
shr ebx,9
cmp ebx,[eax+file_handler.bufer_block]
je .l3
mov [eax+file_handler.first_block],ebx
mov [eax+file_handler.bufer_block],ebx
mov dword[eax+file_handler.n_blocks],1
lea ebx,[eax+file_handler.operation]
mov eax,58
int 40h
cmp eax,0ffffff00h
jnc .error
.l3:
mov eax,[esp+28]
mov edx,[eax+file_handler.position]
mov esi,[eax+file_handler.bufer]
and edx,511
add esi,edx
neg edx
add edx,512
cmp ecx,edx
jc .l4
mov ecx,edx
.l4:
add [eax+file_handler.position],ecx
sub [esp+24],ecx
pop edi
call movedata
push edi
popad
ret
.error:
popad
popad
xor ecx,ecx
stc
ret
 
 
ftell: mov edx,[eax+file_handler.position]
ret
lseek: ;eax=file edx=pos
mov [eax+file_handler.position],edx
ret
skip: ;eax=file edx=bytes to skip
add [eax+file_handler.position],edx
ret
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/jpegview/trunk/jpegdat.asm
0,0 → 1,22
modes:
dd mcu100,color100,8,8 ;monocromo
dd mcu111,color111,8,8
dd mcu211,color211,16,8
dd mcu411,color411,16,16
 
zigzag:
db 0,0, 4+1,0, 32,1, 64,1, 36,2, 8+1,0, 12+1,0, 40,4
db 68,2, 96,1, 128,1, 100,2, 72,4, 44,8, 16+1,0, 20+1,0
db 48,16, 76,8, 104,4, 132,2, 160,1, 192,1, 164,2, 136,4
db 108,8, 80,16, 52,32, 24+1,0, 28+1,0, 56,64, 84,32, 112,16
db 140,8, 168,4, 196,2, 224,1, 228,2, 200,4, 172,8, 144,16
db 116,32, 88,64, 60,128, 92,128, 120,64, 148,32, 176,16, 204,8
db 232,4, 236,8, 208,16, 180,32, 152,64, 124,128, 156,128, 184,64
db 212,32, 240,16, 244,32, 216,64, 188,128, 220,128, 248,64, 252,128
 
k:
dd 1.41421,1.84776,1.08239,-2.6131
k2:
dd 0.3535534,0.49039264,0.46193953,0.415734806
dd 0.3535534,0.277785116,0.191341716,0.0975451609
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/jpegview/trunk/jpeglib.asm
0,0 → 1,1179
;405 412 586
;
;
bufer_size=1024*16+2
fichero=4
mcu_ptr=8
color_ptr=12
estado=16
color_c=17
nbits=color_c
idct=20
tmp_bits=24
actable=28
matriz_limit=32
sourcebits=36
sourcebits_index=40
sourcebits_limit=44
qt_ptrs=48
ht_dc_ptrs=64
ht_ac_ptrs=80
matrices=96
tmp_bufer=100
x_org=104
y_org=108
x_mcu=112
y_mcu=116
x_size=120
y_size=124
x_org2=128
y_org2=132
x_mcu2=136
y_mcu2=140
x_size2=144
y_size2=148
q_ptr=152
dc=164
position=204
draw_ptr=208
struct_size=212
 
jpeg_info: ;fichero en eax
;retorna ebp
xor ebp,ebp
pushad
mov ebp,esp
mov ecx,6
sub esp,ecx
mov edi,esp
call read
pop dx
cmp dx,0d8ffh
je .l1
mov esp,ebp
popad
ret
.l1: push eax
mov ecx,struct_size
call mallocz
mov [edi],ebp
mov ebp,edi
pop dword [ebp+fichero]
pop ax
pop cx
jmp .l3
.l2: mov ebx,[ebp+tmp_bufer]
add ebx,[ebx-4]
mov cx,[ebx-2]
mov ax,[ebx-4]
.l3: push .l2
xchg cl,ch
add cx,2
cmp ch,3
jnc .l4
cmp al,0ffh
jne eoi
cmp ah,0dbh
je dqt
cmp ah,0c4h
je dht
cmp ah,0c0h
je sof0
cmp ah,0dah
je sos
cmp ah,0c2h
je eoi
cmp ah,0c9h
je eoi
cmp ah,0d9h
je eoi
.l4: lea edx,[ecx-4]
xor ecx,ecx
mov eax,[ebp+fichero]
call skip
mov ecx,4
call READ
cmp ecx,[edi-4]
jne eoi
ret
 
eoi:
mov esp,[ebp]
call jpeg_close
popad
xor ebp,ebp
ret
 
jpeg_close:
test ebp,ebp
jz .l2
pushad
mov eax,[ebp+fichero]
call close
mov edi,[ebp+sourcebits]
call free
lea esi,[ebp+qt_ptrs]
mov ecx,14
.l1: mov edi,[esi]
add esi,4
call free
loop .l1
mov edi,ebp
call free
popad
.l2: ret
 
dqt: call READ
mov esi,edi
lea eax,[edi+ecx]
push eax
.l1: xor eax,eax
lodsb
cmp al,4
jnc eoi
lea ebx,[ebp+qt_ptrs+eax*4]
test dword [ebx],-1
jnz eoi
mov ecx,64
xor eax,eax
sub esp,128
mov edi,esp
.l2: lodsb
stosw
loop .l2
mov ecx,256
call malloc
mov [ebx],edi
mov eax,esi
mov esi,esp
pushad
mov ebp,zigzag
fninit
mov cl,64
xor eax,eax
.l3: fild word[esi]
mov al,[ebp]
and al,-2
add ebp,2
add esi,2
mov ebx,eax
and ebx,28
fmul dword [ebx+k2]
mov ebx,eax
shr ebx,3
and ebx,4+8+16
fmul dword [ebx+k2]
fstp dword [edi+eax]
dec cl
jnz .l3
popad
mov esi,eax
add esp,128
mov eax,[esp]
sub eax,esi
jc eoi
cmp eax,4
ja .l1
jne eoi
pop eax
ret
 
sof0: call READ
cmp byte [edi],8
jne eoi ;precision
mov ax,[edi+1]
xchg al,ah
mov [ebp+y_size],ax
mov ax,[edi+3]
xchg al,ah
mov [ebp+x_size],ax
mov al,[edi+5] ;ncomponentes
mov cl,al
mov [ebp+color_c],al
mov edx,modes
dec al
jz .l1
dec al
dec al
jnz eoi
mov al,[edi+10]
mov ah,[edi+13]
cmp ax,1111h
jne eoi
mov al,[edi+7]
add edx,16
cmp al,11h
je .l1
add edx,16
cmp al,21h
je .l1
add edx,16
cmp al,22h
jne eoi
.l1: lea ebx,[ebp+q_ptr]
lea esi,[ebp+qt_ptrs]
mov [ebp+mcu_ptr],edx
.l2: movzx eax,byte [edi+8]
add edi,3
cmp al,4
jnc eoi
lea eax,[eax*4+esi]
mov [ebx],eax
add ebx,16
dec cl
jnz .l2
ret
 
READ: mov eax,[ebp+fichero]
mov edi,[ebp+tmp_bufer]
movzx ecx,cx
call mresize
mov [ebp+tmp_bufer],edi
jmp read
 
dht: call READ
mov esi,edi
lea eax,[edi+ecx]
push eax
.l1: lodsb
mov edi,esi
mov ebx,3+16
and bl,al
cmp bl,al
jne eoi
shr bl,2
and al,3
or bl,al
lea ebx,[ebp+ht_dc_ptrs+ebx*4]
test dword [ebx],-1
jnz eoi
mov cl,15
mov al,[edi]
.l2: inc edi ;calcular numero de codigos
add al,[edi]
jc eoi
dec cl
jnz .l2
movzx ecx,al
lea ecx,[ecx*4+2]
call malloc
mov [ebx],edi
call arbol_hf
mov eax,[esp]
sub eax,ebx
jc eoi
mov esi,ebx
cmp eax,4
ja .l1
jne eoi
pop eax
ret
 
arbol_hf: ;esi=ht edi=memoria para el arbol
;retorna en ebx el final de ht
;codigos: bits 0-3=nbits del siguiente numero
; bits 4-7=numero de zeros
; bits 8-14=longitud de este codigo o error si =127
; bit 15=codigo/puntero
push ebp
lea ebx,[edi-2]
add ebx,[ebx-2]
mov word [ebx],-1 ;codigo de error si encontrado
push ebx
push esi
lea ebx,[esi+16]
mov ebp,esp
xor ecx,ecx
push edi
push ecx
add edi,2
mov dx,1
add dh,[esi]
jz .l3
jmp .l2
.l1: push edi
push ecx
add edi,2
.l2: inc cl
cmp cl,dl
jc .l1
mov al,[ebx]
inc ebx
mov ah,128 ;marca de codigo
or ah,dl
cmp edi,[ebp+4]
jnc .l5
stosw
cmp esp,ebp
jnc .l5
pop ecx
pop esi
lea eax,[edi-2]
sub eax,esi
mov [esi],ax
dec dh
jnz .l2 ;ncodigos
mov esi,[ebp]
.l3: inc esi
inc dl
cmp dl,17
jnc .l4
add dh,[esi]
jz .l3
mov [ebp],esi
jmp .l2
.l4: lea esp,[ebp+8]
pop ebp
ret
.l5: mov ebp,[ebp+8]
jmp eoi
 
sos: sub ecx,4 ;a continuacion vienen los datos de la imagen
call READ
mov eax,[ebp+fichero]
call ftell
mov [ebp+position],edx
mov esi,edi
lea edi,[ebp+q_ptr]
lodsb ;numero de componentes
sub [ebp+color_c],al
jnz eoi
mov dh,al
.l1: mov ebx,[edi]
mov eax,[ebx]
stosd
lodsw
mov cl,ah
and eax,0f00h
and ecx,0f0h
shr eax,6
shr ecx,2
lea ebx,[ebp+ht_ac_ptrs+eax]
mov eax,[ebx]
lea ebx,[ebp+ht_dc_ptrs+ecx]
mov ecx,[ebx]
test eax,eax
jz eoi
test ecx,ecx
jz eoi
stosd
mov eax,ecx
stosd
add edi,4
dec dh
jnz .l1
mov edx,[ebp+mcu_ptr]
cmp edx,modes
jne .l2
lea esi,[ebp+q_ptr]
lea edi,[ebp+q_ptr+32]
movsd
movsd
movsd
.l2:
mov esi,edx
push dword [esi]
pop dword [ebp+mcu_ptr]
push dword [esi+4]
pop dword[ebp+color_ptr]
push dword [esi+12]
pop dword [ebp+y_mcu]
push dword [esi+8]
pop dword [ebp+x_mcu]
mov ecx,64*18
call malloc
mov [ebp+matrices],edi
mov ecx,bufer_size
call malloc
mov [ebp+sourcebits],edi
mov esp,[ebp]
mov [esp+8],ebp
popad
ret
 
jpeg_display:
test ebp,ebp
jnz .inicio
ret
.inicio:
pushad
mov [ebp],esp
mov eax,[ebp+fichero]
mov edx,[ebp+position]
call lseek
mov edi,[ebp+sourcebits]
add edi,bufer_size
mov [ebp+sourcebits_index],edi
sub edi,2
mov [ebp+sourcebits_limit],edi
mov edi,[ebp+matrices]
mov [ebp+matriz_limit],edi
xor eax,eax
mov [esp+8],eax
mov [ebp+estado],eax
mov [ebp+tmp_bits],eax
mov [ebp+dc],eax
mov [ebp+dc+16],eax
mov [ebp+dc+32],eax
 
mov eax,[ebp+y_mcu]
mov ecx,[ebp+y_org]
sub ecx,eax
mov [ebp+y_org2],ecx
mov [ebp+y_mcu2],eax
push dword [ebp+y_size]
pop dword [ebp+y_size2]
.l3: push dword [ebp+x_org]
pop dword [ebp+x_org2]
push dword [ebp+x_mcu]
pop dword [ebp+x_mcu2]
push dword [ebp+x_size]
pop dword [ebp+x_size2]
mov eax,[ebp+y_mcu2]
add [ebp+y_org2],eax
sub [ebp+y_size2],eax
jnc .l4
add eax,[ebp+y_size2]
jnz .cont
mov [esp+8],ebp
popad
ret
.cont:
mov dword [ebp+y_size2],0
mov [ebp+y_mcu2],eax
.l4:
mov eax,[ebp+x_mcu2]
sub [ebp+x_size2],eax
jnc .l5
add eax,[ebp+x_size2]
jz .l3
mov dword [ebp+x_size2],0
mov [ebp+x_mcu2],eax
call dword [ebp+mcu_ptr]
mov eax,[ebp+x_mcu]
mov ecx,[ebp+x_mcu2]
mov edx,[ebp+y_mcu2]
call recortar
jmp .l6
.l5:
call dword [ebp+mcu_ptr]
mov ecx,[ebp+x_mcu2]
mov edx,[ebp+y_mcu2]
.l6:
mov eax,[ebp+x_org2]
mov ebx,[ebp+y_org2]
call dword [ebp+draw_ptr]
add [ebp+x_org2],ecx
mov ax,[ebp+estado]
test al,15
jz .l4
cmp ah,8
jnc .l4
xor edx,edx
mov [ebp+tmp_bits],edx
mov [ebp+dc],edx
mov [ebp+dc+16],edx
mov [ebp+dc+32],edx
add dword [ebp+sourcebits_index],2
and word [ebp+estado],0c0h
test al,32
jz .l4
jmp .l3
 
color100:
push edi
.l1: lodsw
mov dl,ah
mov ah,al
stosw
mov ah,dl
stosb
mov al,dl
stosb
stosw
dec cl
jnz .l1
pop edi
ret
 
color111:
push edi
.l1: lodsw
mov bx,[esi+62]
mov dx,[esi+126]
xchg ah,bh
xchg ah,dl
xchg ah,bl
stosw
mov ax,bx
stosw
mov ax,dx
stosw
dec cl
jnz .l1
pop edi
mov ecx,64*3
jmp ybr_bgr
 
color411:
push ebp
push edi
lea ebp,[esi+ecx*8]
.l1: push ecx
mov ax,[esi]
mov cx,[ebp]
mov dx,[ebp+64]
add ebp,2
xchg ch,dl
mov bx,ax
mov ah,cl
mov bl,ch
mov [edi],ax
mov [edi+2],bx
mov [edi+4],cx
mov ax,[esi+8]
mov bh,ah
mov ah,cl
mov [edi+48],ax
mov [edi+48+2],bx
mov [edi+48+4],cx
mov ax,[esi+2]
mov bx,ax
mov ah,dl
mov bl,dh
mov [edi+6],ax
mov [edi+2+6],bx
mov [edi+4+6],dx
mov ax,[esi+8+2]
mov bh,ah
mov ah,dl
mov [edi+48+6],ax
mov [edi+48+2+6],bx
mov [edi+48+4+6],dx
pop ecx
add edi,12
dec ecx
add esi,4
test cl,1
jnz .l1
add esi,64-8
test cl,2
jnz .l1
sub esi,128-16
add edi,48
test cl,15
jnz .l1
add esi,64
test cl,cl
jnz .l1
pop edi
pop ebp
mov ecx,64*4*3
jmp ybr_bgr
 
color211:
push ebp
push edi
lea ebp,[esi+ecx*4]
.l1: push ecx
mov ax,[esi]
mov cx,[ebp]
mov dx,[ebp+64]
add ebp,2
xchg ch,dl
mov bx,ax
mov ah,cl
mov bl,ch
mov [edi],ax
mov [edi+2],bx
mov [edi+4],cx
mov ax,[esi+2]
mov bx,ax
mov ah,dl
mov bl,dh
mov [edi+6],ax
mov [edi+2+6],bx
mov [edi+4+6],dx
pop ecx
add edi,12
dec cl
add esi,4
test cl,1
jnz .l1
add esi,64-8
test cl,2
jnz .l1
sub esi,128-8
test cl,cl
jnz .l1
pop edi
pop ebp
mov ecx,64*3*2
jmp ybr_bgr
 
 
mcu411: lea ebx,[ebp+q_ptr]
call hufdecode
lea ebx,[ebp+q_ptr]
call hufdecode
mcu211: lea ebx,[ebp+q_ptr]
call hufdecode
mcu111: lea ebx,[ebp+q_ptr]
call hufdecode
lea ebx,[ebp+q_ptr+16]
call hufdecode
mcu100: lea ebx,[ebp+q_ptr+32]
call hufdecode
mov esi,[ebp+matrices]
mov dword [ebp+matriz_limit],esi
mov ecx,32
lea edi,[esi+64*6]
jmp dword [ebp+color_ptr]
 
cargar_bits: ;edx=bits,cl=nbits,
;bp=data struct
;cr: cl,edx,eax,si
;ncr bx,bp,di,ch
 
mov esi,[ebp+sourcebits_index]
cmp esi,[ebp+sourcebits_limit]
jnc .l6
movzx eax,byte [esi]
inc esi
add cl,8
cmp al,-1
je .l2
mov ah,al
lodsb
add cl,8
cmp al,-1
je .l2
.l1: ror eax,cl
or edx,eax
mov [ebp+sourcebits_index],esi
ret
.l2: lodsb
test al,al
jnz .l3
mov al,-1
call .l1
cmp cl,16
jc cargar_bits
ret
.l3: sub esi,2
sub cl,8
sub al,0d0h
cmp al,8
jc .l4
sub al,9
mov al,63
jz .l4
mov al,127
.l4: inc al
or [ebp+estado],al
movzx eax,ah
jmp .l1
.l5: mov [ebp+sourcebits_limit],edi
mov word [edi],0d9ffh
popad
jmp cargar_bits
.l6: ;read file
pushad
mov ecx,bufer_size-2
mov edx,[ebp+sourcebits_limit]
mov edi,[ebp+sourcebits]
mov ax,[edx]
sub edx,edi
stosw
sub esi,edx
mov [ebp+sourcebits_index],esi
cmp edx,ecx
jne .l5
mov eax,[ebp+fichero]
call read
lea ecx,[edi+ecx-2]
mov [ebp+sourcebits_limit],ecx
popad
jmp cargar_bits
 
 
hufdecode: ;si->dctable [bp+20]->actable di->outbufer edx->bits cl->bits en edx
 
 
;[bp+24]->sourcebits
;[bp+22]=outbufer+128
;[bx] q ptr para aa&n
;[bx+2] a ptr
;[bx+4] d ptr
;[bx+8] dc componente
fninit
push dword [ebx]
mov cl,[ebp+nbits]
mov edx,[ebp+tmp_bits]
cmp cl,16
jnc .l1
call cargar_bits
.l1: mov eax,[ebx+4]
mov esi,[ebx+8]
mov [ebp+actable],eax
movzx eax,word [esi]
add esi,2
.l2: add edx,edx
jnc .l3
add esi,eax
.l3: lodsw
test ax,ax
jns .l2
;codigo encontrado
and ax,7f0fh
mov edi,[ebp+matriz_limit] ;arrays
sub cl,ah
jns .l4
fldz
.error:
xor ecx,ecx
or byte [ebp+estado],32
jmp .l12
.l4: cmp cl,al
jnc .l5
push eax
call cargar_bits
pop eax
.l5: sub cl,al
mov ch,cl
mov cl,al
mov eax,edx
shl edx,cl
sar eax,17
xor ax,8000h
xor cl,15
sar ax,cl
mov cl,ch
mov ch,2
add ax,8000h ;incrementar si negativo
adc ax,8000h
add [ebx+12],ax
fild word [ebx+12]
push ecx
mov ecx,64
xor eax,eax
add [ebp+matriz_limit],ecx
rep stosd
pop ecx
sub edi,64*4
mov ebx,[esp]
fmul dword [ebx]
.l6: cmp cl,16
jnc .l7
call cargar_bits
.l7: mov esi,[ebp+actable]
movzx eax,word[esi]
add esi,2
.l8: add edx,edx
jnc .l9
add esi,eax
.l9: lodsw
test ax,ax
jns .l8
;codigo encontrado
and ah,127
xor ebx,ebx
sub cl,ah
js .error
or bl,al
jz .l12
and al,0f0h
shr al,3
add ch,al
js .error
and bl,0fh
jz .l11
cmp cl,bl
jnc .l10
call cargar_bits
.l10: sub cl,bl
xchg bl,cl
mov eax,edx
shl edx,cl
sar eax,17
xor cl,15
xor ax,8000h
sar ax,cl
add ax,8000h ;incrementar si negativo
adc ax,8000h
mov cl,bl
mov bl,ch
mov [ebp+tmp_bits],ax
mov ax,[ebx+zigzag]
mov ebx,[esp]
fild word [ebp+tmp_bits]
or [ebp+idct],ax
and eax,11111100b
fmul dword [ebx+eax]
fstp dword [edi+eax]
.l11: add ch,2
jns .l6
.l12: mov [ebp+nbits],cl
mov [ebp+tmp_bits],edx
xor ebx,ebx
add esp,4
xchg ebx,[ebp+idct]
cmp ch,2
je idctf1
fstp dword [edi]
test bh,0feh
jnz idctf3
idctf2a: test bh,1
mov esi,edi
jz .l1
test bl,1
jnz idctf3
push idctf2b
jmp idctf3b
.l1: call idctf3a
mov cl,4
call limit
mov eax,[edi-8]
mov edx,[edi-4]
mov cl,7
.l2: mov [edi],eax
mov [edi+4],edx
add edi,8
dec cl
jnz .l2
ret
 
idctf1: fistp word[edi+64]
mov ax,128
add ax,[edi+64]
jz .l2
test ah,ah
jz .l1
mov al,-1
js .l2
.l1: mov ah,al
stosw
stosw
mov eax,[edi-4]
mov ecx,15
rep stosd
.l2: ret
 
idctf3: mov bl,8
mov esi,edi
.l1: rcr bh,1
jc .l3
mov eax,[esi]
test eax,eax
jz .l4
mov cl,7
.l2: add esi,32
mov [esi],eax
dec cl
jnz .l2
sub esi,32*7-4
dec bl
jnz .l1
jmp .l5
.l3: call idctf3b
.l4: add esi,4
dec bl
jnz .l1
.l5: mov esi,edi
mov cl,8
.l6: call idctf3a
add esi,32
add edi,16
dec cl
jnz .l6
sub edi,128
mov esi,edi
mov cl,32
limit: mov dx,[esi]
mov bx,[esi+2]
add esi,4
add dx,128
add bx,128
test dh,dh
mov ax,dx
jz .l1
mov al,0
js .l1
mov al,-1
.l1: test bh,bh
mov ah,bl
jz .l2
mov ah,0
js .l2
mov ah,-1
.l2: stosw
dec cl
jnz limit
ret
 
idctf2b:
mov dl,8
.l1: fld dword[esi]
add esi,32
mov ax,128
fistp word [edi]
add ax,[edi]
test ah,ah
jz .l2
mov al,0
js .l2
mov al,-1
.l2: mov ah,al
stosw
stosw
stosw
stosw
dec dl
jnz .l1
ret
 
idctf3a: ;si(d float),di(w int) ncr
fld dword[esi+1*4] ;f1 ;t21=f1+f7
fld st0
fld dword[esi+7*4] ;f7
fadd st2,st0
fsubp st1,st0 ;t22=f1-f7
fld dword[esi+5*4]
fld st0 ;f5 ;t23=f5+f3
fld dword[esi+3*4] ;f3
fadd st2,st0
fsubp st1,st0 ;t20=f5-f3
fld st0
fadd st0,st3 ;t25=(t20+t22)*k2
fmul dword[k+4] ;k2 ;t25,t20,t23,t22,t21
fld st4 ;t7=t21+t23
fadd st0,st3 ;t7,t25,t20,t23,t22,t21
fld dword[k+12] ;k4 ;t6=k4*t20+t25-t7
fmulp st3,st0
fsub st2,st0
fld st1
faddp st3,st0 ;t7,t25,t6,t23,t22,t21
fld st5 ;t5=(t21-t23)*k1-t6
fsub st0,st4
fmul dword[k] ;k1
fsub st0,st3
fstp st6 ;t7,t25,t6,t23,t22,t5
fstp st3 ;t25,t6,t7,t22,t5
fxch st3
fmul dword[k+8] ;k3 ;t4=k3*t22-t25+t5
fadd st0,st4 ;t22*k3+t5,t6,t7,t25,t5
fsubrp st3,st0 ;t6,t7,t4,t5
fld dword[esi] ;f0 ;t10=f0+f4
fst st5 ;f0,t4,t5,t6,t7,f0
fld dword[esi+4*4] ;f4
fsub st6,st0 ;t11=f0-f4
faddp st1,st0
fld st0 ;t10,t10,t6,t7,t4,t5,t11
fld dword[esi+2*4] ;f2 ;t13=f2+f6
fadd dword[esi+6*4] ;f6 ;t13,t10,t10,t6,t7,t4,t5,t11
fadd st2,st0 ;t13,t10,t0,t6,t7,t4,t5,t11 ;t0=t10+t13
fsubp st1,st0 ;t3,t0,t6,t7,t4,t5,t11 ;t3=t10-t13
fld st0 ;p3=t3-t4
fsub st0,st5
fistp word [edi+3*2] ;p3
fadd st0,st4 ;p4=t3+t4
fld dword[esi+2*4] ;f2
fstp st5
fistp word [edi+4*2] ;p4 ;t0,t6,t7,f2,t5,t11
fld st0 ;p0=t0+t7
fsub st0,st3
fistp word [edi+7*2] ;p7
fadd st0,st2 ;p7=t0-t7
fistp word [edi] ;p0 ;t6,t7,f2,t5,t11
fld st2 ;f2 ;f2,t6,t7,f2,t5,t11 ;t12=(f2-f6)*k1-t13
fld dword[esi+6*4] ;f6
fadd st4,st0 ;f6,f2,t6,t7,t13,t5,t11
fsubp st1,st0
fmul dword[k] ;k1
fsub st0,st3
fst st3 ;t12,t6,t7,t12,t5,t11
fadd st0,st5 ;t1=t11+t12
fst st2 ;t1,t6,t1,t12,t5,t11
fadd st0,st1 ;p1=t1+t6
fistp word [edi+2] ;p1 ;t6,t1,t12,t5,t11
fsubp st1,st0 ;p6=t1-t6
fistp word [edi+6*2] ;p6 ;t12,t5,t11
fsubp st2,st0 ;t2=t11-t12 ;t5,t2
fld st0
fadd st0,st2 ;p2=t2+t5
fistp word [edi+2*2] ;p2
fsubp st1,st0 ;p5=t2-t5 ;t5,t2
fistp word [edi+5*2]
ret ;p5
 
 
 
 
idctf3b: ;si ncr
fld dword[esi+1*32]
fld st0 ;f1 ;t21=f1+f7
fld dword[esi+7*32]
fadd st2,st0 ;f7
fsubp st1,st0 ;t22=f1-f7
fld dword[esi+5*32]
fld st0 ;f5 ;t23=f5+f3
fld dword[esi+3*32] ;f3
fadd st2,st0
fsubp st1,st0
fld st0 ;t20=f5-f3
fadd st0,st3 ;t25=(t20+t22)*k2
fmul dword[k+4] ;k2 ;t25,t20,t23,t22,t21
fld st4 ;t7=t21+t23
fadd st0,st3 ;t7,t25,t20,t23,t22,t21
fld dword[k+12] ;k4 ;t6=k4*t20+t25-t7
fmulp st3,st0
fsub st2,st0
fld st1
faddp st3,st0 ;t7,t25,t6,t23,t22,t21
fld st5 ;t5=(t21-t23)*k1-t6
fsub st0,st4
fmul dword[k] ;k1
fsub st0,st3
fstp st6 ;t7,t25,t6,t23,t22,t5
fstp st3
fxch st3 ;t25,t6,t7,t22,t5
fmul dword[k+8] ;k3 ;t4=k3*t22-t25+t5
fadd st0,st4 ;t22*k3+t5,t6,t7,t25,t5
fsubrp st3,st0 ;t6,t7,t4,t5
fld dword[esi] ;f0 ;t10=f0+f4
fst st5 ;f0,t4,t5,t6,t7,f0
fld dword[esi+4*32] ;f4
fsub st6,st0 ;t11=f0-f4
faddp st1,st0
fld st0 ;t10,t10,t6,t7,t4,t5,t11
fld dword[esi+2*32] ;f2 ;t13=f2+f6
fadd dword[esi+6*32] ;f6 ;t13,t10,t10,t6,t7,t4,t5,t11
fadd st2,st0 ;t13,t10,t0,t6,t7,t4,t5,t11 ;t0=t10+t13
fsubp st1,st0 ;t3,t0,t6,t7,t4,t5,t11 ;t3=t10-t13
fld st0 ;p3=t3-t4
fsub st0,st5
fstp dword[esi+3*32] ;p3
fadd st0,st4 ;p4=t3+t4
fld dword[esi+2*32] ;f2
fstp st5
fstp dword[esi+4*32] ;p4 ;t0,t6,t7,f2,t5,t11
fld st0
fsub st0,st3 ;p0=t0+t7
fstp dword[esi+7*32] ;p7
fadd st0,st2 ;p7=t0-t7
fstp dword[esi] ;p0 ;t6,t7,f2,t5,t11
fld st2 ;f2 ;f2,t6,t7,f2,t5,t11 ;t12=(f2-f6)*k1-t13
fld dword[esi+6*32] ;f6
fadd st4,st0 ;f6,f2,t6,t7,t13,t5,t11
fsubp st1,st0
fmul dword[k] ;k1
fsub st0,st3
fst st3 ;t12,t6,t7,t12,t5,t11
fadd st0,st5 ;t1=t11+t12
fst st2 ;t1,t6,t1,t12,t5,t11
fadd st0,st1 ;p1=t1+t6
fstp dword[esi+1*32] ;p1 ;t6,t1,t12,t5,t11
fsubp st1,st0 ;p6=t1-t6
fstp dword[esi+6*32] ;p6 ;t12,t5,t11
fsubp st2,st0
fld st0 ;t2=t11-t12 ;t5,t2
fadd st0,st2 ;p2=t2+t5
fstp dword[esi+2*32] ;p2
fsubp st1,st0 ;p5=t2-t5 ;t5,t2
fstp dword[esi+5*32]
ret ;p5
 
ybr_bgr: ;edi=bmp ecx=n_BYTES
;retorna edi+=ecx
pushad
mov esi,edi
add edi,ecx
push edi
mov edi,[colortabla]
.l1: lodsw
movzx ebx,ah
movzx ebp,al
movzx eax,al
movzx ecx,byte[esi]
lea ebx,[ebx*4+edi+1024]
lea ecx,[ecx*4+edi]
add eax,[ebx] ;cb ;solo se usan 16 bits
mov edx,[ebx+2] ;pero el codigo de 32 bits es mas rapido
mov ebx,[ecx] ;cr
add eax,[ecx+2]
add ebx,ebp ;b
add edx,ebp ;r
test ah,ah
jz .l2
mov al,0
js .l2
mov al,-1
.l2: test dh,dh
jz .l3
mov dl,0
js .l3
mov dl,-1
.l3: test bh,bh
mov dh,al
jz .l4
mov bl,0
js .l4
mov bl,-1
.l4: mov [esi-2],dx
mov [esi],bl
inc esi
cmp esi,[esp]
jc .l1
pop edi
popad
ret
 
recortar: ;edi=bufer eax=ancho en pixels (ecx,edx)tama¤o deseado
pushad
dec edx
jz .l2
lea ebx,[ecx*3]
lea eax,[eax*3]
lea esi,[edi+eax]
add edi,ebx
sub eax,ebx
.l1: mov ecx,ebx
call movedata
add esi,eax
dec edx
jnz .l1
.l2: popad
ret
 
;R = Y + 1.402 *(Cr-128)
;G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128)
;B = Y + 1.772 *(Cb-128)
 
colortabla: dd 0
 
colorprecalc: ;prepara la tabla para convertir ycb a rgb
mov ecx,1024*2
call malloc
mov [colortabla],edi
fninit
fld dword [.k+4]
fld dword [.k]
mov dl,0
call .l1
fld dword [.k+12]
fld dword[.k+8]
.l1: mov cx,-128
.l2: mov [edi],ecx
inc ecx
fild word[edi]
fld st0
fmul st0,st2
fistp word[edi]
fmul st0,st2
fistp word[edi+2]
add edi,4
inc dl
jnz .l2
ret
 
.k: dd 1.402,-0.71414,-0.34414,+1.772
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/jpegview/trunk/jpegview.asm
0,0 → 1,638
; IMGVIEW.ASM
;
; This program displays jpeg images. The window can be resized.
;
; Version 0.0 END OF 2003
; Octavio Vega
; Version 0.1 7th March 2004
; Mike Hibbett ( very small part! )
; Version 0.11 7th April 2004
; Ville Turjanmaa ( 'set_as_bgr' function )
; Version 0.12 29th May 2004
; Ivan Poddubny (correct "set_as_bgr"+parameters+boot+...)
; Version 0.12 30 de mayo 2004
; Octavio Vega
; bugs correction and slideshow
; version 0.13 3 de junio 2004
; Octavio Vega
; unos retoques
; version 0.14 10th August 2004
; Mike Hibbett Added setting default colours
;
memsize=20000h
org 0
PARAMS = memsize - 1024
 
use32
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd memsize ; memory for app
dd memsize - 1024 ; esp
dd PARAMS , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
stack_size=4096 + 1024
 
 
START: ; start of execution
 
cmp [PARAMS], byte 0
jne check_parameters
 
; Calculate the 'free' memory available
; to the application, and create the malloc block from it
.l1:
mov ecx,memsize-fin-stack_size
mov edi,fin
call add_mem
 
; Get some memory
mov ecx,16384
call malloc
mov [work_area],edi
call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr
call draw_window
call read_string.rs_done
 
still:
push still
mov ebx,100 ;1 second
mov eax,23 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
je draw_window
cmp eax,2 ; key in buffer ?
je read_string
cmp eax,3 ; button in buffer ?
je button
jmp display_next
 
button: ; BUTTON
mov eax,17
int 0x40
cmp ah,3
je set_as_bgr2
cmp ah,2
je slideshow
cmp ah,1 ; CLOSE PROGRAM
jne close_program.exit
close_program:
mov eax,-1
int 0x40
.exit:
ret
 
; Put a 'chunk' of the image on the window
put_image:
pushad
 
lea ebp,[edx+eax+7]
cmp [winxs],bp
jc .l1
lea ebp,[ecx+ebx+20+2+17]
cmp [winys],bp
jc .l1
 
add eax,5 ; offset for boarder
add ebx,20 ; offset for title bar
push ax ; pox
push bx ; pos
push cx ; size
push dx ; size
pop ecx
pop edx
mov ebx,edi
mov eax,7
 
int 40h ; Put image function
.l1:
popad
ret
 
 
 
;******************************************************************************
 
check_parameters:
cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler
je boot_set_background
 
mov edi, name_string ; clear string with file name
mov al, 0
mov ecx, 100
rep stosb
 
mov ecx, 100 ; calculate length of parameter string
mov edi, PARAMS
repne scasb
sub edi, PARAMS
mov ecx, edi
 
mov esi, PARAMS ; copy parameters to file name
mov edi, name_string
cld
rep movsb
 
jmp START.l1 ; return to beggining of the progra
 
;******************************************************************************
 
 
set_default_colours:
 
pusha
 
mov eax,6 ; load default color map
mov ebx,defcol
mov ecx,0
mov edx,-1
mov esi,0x10000
int 0x40
 
mov eax,48 ; set default color map
mov ebx,2
mov ecx,0x10000
mov edx,10*4
int 0x40
 
popa
ret
 
defcol db 'DEFAULT.DTP'
 
 
boot_set_background:
call set_default_colours
 
mov ecx,memsize-fin-stack_size ; size
mov edi,fin ; pointer
call add_mem ; mark memory from fin to 0x100000-1024 as free
; Get some memory
mov ecx,16384 ; get 16 Kb of memory
call malloc ; returns pointer in edi
mov [work_area],edi ; save it
call colorprecalc ; calculate colors
mov esi,name_string
call open
test eax,eax
jz close_program
call jpeg_info
mov dword [jpeg_st],ebp
call set_as_bgr2 ; set wallpaper
jmp close_program ; close the program right now
 
;******************************************************************************
;******************************************************************************
 
set_as_bgr2:
mov ebp,dword[jpeg_st]
test ebp,ebp
jz .end
 
mov dword [ebp+draw_ptr],put_chunk_to_bgr
call jpeg_display
mov eax, 15
mov ebx, 1
mov ecx, [ebp + x_size]
mov edx, [ebp + y_size]
int 0x40
 
; Stretch the image to fit
mov eax, 15
mov ebx, 4
mov ecx, 2
int 0x40
 
mov eax, 15
mov ebx, 3
int 0x40
 
 
.end:
ret
 
;******************************************************************************
 
put_chunk_to_bgr:
pushad
 
mov [x_pointer], edi
mov esi, ecx
imul esi, 3
mov [x_numofbytes], esi
mov ecx, [ebp + x_size]
imul ecx, ebx
add ecx, eax
imul ecx, 3
mov [x_offset], ecx
mov [x_counter], edx
mov eax, [ebp + x_size]
imul eax, 3
mov [x_numofb2], eax
.new_string:
mov eax, 15
mov ebx, 5
mov ecx, [x_pointer]
mov edx, [x_offset]
mov esi, [x_numofbytes]
int 0x40
mov eax, [x_numofbytes]
add [x_pointer], eax
mov eax, [x_numofb2]
add [x_offset], eax
dec [x_counter]
jnz .new_string
 
popad
ret
 
;******************************************************************************
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12
mov ebx,1
int 0x40
 
; Draw the window to the appropriate size - it may have
; been resized by the user
mov eax, 0
cmp [winxs], ax
jne dw_001
 
; Give the screen some inital defaults
mov ax, 400
mov [winxs], ax
mov ax, 300
mov [winys], ax
mov ax, 100
mov [winxo], ax
mov [winyo], ax
jmp dw_002
 
dw_001:
mov eax, 9
mov ebx, memsize - 1024
mov ecx, -1
int 0x40
mov eax, [ebx + 34]
mov [winxo], ax
mov eax, [ebx + 38]
mov [winyo], ax
mov eax, [ebx + 42]
mov [winxs], ax
mov eax, [ebx + 46]
mov [winys], ax
 
dw_002:
mov bx, [winxo]
shl ebx, 16
mov bx, [winxs]
 
mov cx, [winyo]
shl ecx, 16
mov cx, [winys]
 
 
mov eax,0 ; DRAW WINDOW
mov edx,[wcolor]
add edx,0x02000000
mov esi,0x80557799
mov edi,0x00557799
int 0x40
 
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x00ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
 
 
mov eax,8 ; CLOSE BUTTON
 
mov bx, [winxs]
sub bx, 19
shl ebx, 16
add ebx, 12
 
mov ecx,5*65536+12
mov edx,1
mov esi,0x557799
int 0x40
 
; draw status bar
mov eax, 13
movzx ebx, word [winxs]
sub ebx, 5
add ebx, 4*65536
mov cx, [winys]
sub ecx, 19
shl ecx, 16
add ecx, 3
mov edx, 0x00557799
int 0x40
 
mov eax,8 ; BUTTON 2: filename
mov ebx,4*65536+55
mov cx, [winys]
sub cx, 16
shl ecx, 16
add ecx, 12
mov esi, 0x00557799
mov edx,2
int 0x40
 
mov eax,4 ; Button text
movzx ebx, word [winys]
sub ebx, 13
add ebx, 6*65536
mov ecx,0x00ffffff
mov edx,setname
mov esi,setnamelen-setname
int 0x40
 
 
mov eax,8 ; BUTTON 3: set as background
mov bx, [winxs]
sub bx, 60
shl ebx, 16
mov bx,55
mov cx, [winys]
sub cx, 16
shl ecx, 16
add ecx, 12
mov esi, 0x00557799
mov edx,3
int 0x40
 
mov eax,4 ; Button text
movzx ebx, word [winxs]
sub ebx, 60
shl ebx,16
mov bx, word [winys]
sub bx,13
mov ecx,0x00ffffff
mov edx,setbgr
mov esi,setbgrlen-setbgr
int 0x40
call print_strings
call load_image
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
 
; Read in the image file name.
read_string:
movzx edi,byte[name_string.cursor]
add edi,name_string
mov eax,2
int 0x40 ; Get the key value
shr eax,8
cmp eax,13 ; Return key ends input
je .rs_done
cmp eax,8
jnz .nobsl
cmp edi,name_string
je .exit
dec edi
mov [edi],byte 0;'_'
dec byte[name_string.cursor]
jmp print_strings
.exit: ret
.nobsl:
cmp eax,31
jbe .exit
cmp eax,97
jb .keyok
sub eax,32
.keyok:
mov ah,0
stosw
cmp edi,name_string.end
jnc print_strings
inc byte[name_string.cursor]
jmp print_strings
.rs_done:
call print_strings
mov esi,name_string
call open
test eax,eax
jz .exit
call jpeg_info
test ebp,ebp
jz close
xchg [jpeg_st],ebp
call jpeg_close
 
load_image:
 
mov eax,13 ; clear picture area
movzx ebx, word [winxs]
sub ebx, 7
add ebx, 4 * 65536
movzx ecx, word [winys]
sub ecx, 39
add ecx, 20 * 65536
 
mov edx,0
int 0x40
mov ebp,[jpeg_st]
test ebp,ebp
jz .exit
mov dword [ebp+draw_ptr],put_image
jmp jpeg_display
.exit: ret
 
print_strings:
pusha
mov eax,13 ; clear text area
movzx ebx, word [winxs]
sub ebx, 64+58
add ebx, 60*65536
mov cx, [winys]
sub cx, 16
shl ecx, 16
add ecx, 12
mov edx,0xffffff
int 0x40
 
mov eax,4 ;
movzx ebx, word [winys]
sub ebx, 14
add ebx, 60*65536
mov ecx,0x000000
mov edx,name_string
mov esi,60
int 0x40
popa
ret
 
slideshow:
test dword[file_dir],-1
jnz .exit
test dword[jpeg_st],-1
jz .exit
mov esi,name_string
movzx ecx,byte[name_string.cursor]
.l1:
cmp byte[esi+ecx],'/'
je .l2
loop .l1
.exit:
ret
.l2:
mov byte[esi+ecx],0
call open
mov byte[esi+ecx],'/'
test eax,eax
jz .exit
 
mov dword[eax+file_handler.size],-1 ;directory size is always 0
mov [file_dir],eax
inc cl
mov [name_string.cursor],cl
 
display_next:
mov eax,[file_dir]
test eax,eax
jnz .l1
ret
.l1:
mov ecx,32
sub esp,ecx
mov edi,esp
call read
cmp ecx,32
jnc .l11
.l10:
add esp,32
mov eax,dword[file_dir]
mov dword[file_dir],0
jmp close
.l11:
mov esi,esp
movzx edi,byte[name_string.cursor]
add edi,name_string
lodsb
cmp al,0
je .l10
cmp al,229
jne .l0
add esp,32
jmp display_next
.l0:
stosb
mov cl,7
.l2:
lodsb
cmp al,32
jna .l3
stosb
loop .l2
.l3:
lea esi,[esp+8]
mov al,'.'
stosb
mov cl,3
.l4:
lodsb
cmp al,32
jna .l5
stosb
loop .l4
.l5:
mov al,0
stosb
cmp edi,name_string.end
jc .l5
add esp,32
call print_strings
mov esi,name_string
call open
test eax,eax
jz display_next
call jpeg_info
test ebp,ebp
jnz .l6
call close
jmp display_next
.l6:
mov dword[ebp+draw_ptr],put_image
push ebp
xchg [jpeg_st],ebp
call jpeg_close
pop ebp
jmp jpeg_display
 
 
 
include 'filelib.asm'
include 'memlib.asm'
include 'jpeglib.asm'
 
 
; DATA AREA
 
wcolor dd 0x000000
labelt db 'Jpegview v0.14'
labellen:
setname db 'SLIDESHOW'
setnamelen:
 
setbgr db ' BGR '
setbgrlen:
 
x_pointer dd 0
x_offset dd 0
x_numofbytes dd 0
x_numofb2 dd 0
x_counter dd 0
winxo: dw 0
winyo: dw 0
winxs: dw 0
winys: dw 0
jpeg_st: dd 0
file_dir: dd 0
work_area: dd 0
tcolor dd 0x000000
btcolor dd 0x224466+0x808080
name_string: db '/rd/1/jpegview.jpg',0
 
rb 100
.end:
.cursor: db 19
.cursor2: db 0
 
align 4
 
rgb16: db 0,4,8,13,17,21,25,29,34,38,42,46,50,55,59,63
rgb4: db 0,21,42,63
 
include 'jpegdat.asm'
 
align 4
 
iniciomemoria:
dd -(iniciomemoria+4),-(iniciomemoria+4),(iniciomemoria+4),.l1,0
.l1 dd 0
 
fin:
I_END:
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/jpegview/trunk/memlib.asm
0,0 → 1,210
 
movedata:
push eax
xor eax,eax
sub eax,edi
and eax,3
xchg ecx,eax
sub eax,ecx
jle .l1
rep movsb
mov ecx,eax
shr ecx,2
rep movsd
and eax,3
.l1: add ecx,eax
rep movsb
pop eax
ret
 
mallocz:
call malloc
pushad
add ecx,3
xor eax,eax
shr ecx,2
rep stosd
popad
ret
 
mresize1: popad
xor edi,edi
stc
mresize2: ret
mresize: ; puntero en di ncr retorna nuevo puntero en di
test edi,edi
jz malloc
cmp ecx,[edi-4]
je mresize2
call free
malloc:
mov edi,ecx
jecxz mresize2
pushad
mov esi,iniciomemoria+4
lea ebx,[ecx+3]
and ebx,-4 ;redondeo a 4
.l1: mov edi,esi
add esi,[esi]
jc mresize1
lodsd
cmp eax,ebx
jc .l1
cmp esi,[iniciomemoria+8]
jc .l2
jne mresize1
lea edx,[ebx+esi+4]
cmp edx,[iniciomemoria+12]
jnc mresize1
mov [iniciomemoria+8],edx
.l2: pop dword [esi-4]
push esi
sub eax,ebx
je .l3
sub eax,4
mov [esi+ebx],eax
jz .l3
;fragmentar
add ebx,4
add [edi],ebx
mov eax,[esi]
sub eax,ebx
mov [esi+ebx],eax
popad
ret
.l3: lodsd
add eax,4
add [edi],eax
popad
ret
 
realloc: test edi,edi
jz malloc
jecxz free
pushad
pop esi
mov eax,[edi-4]
call malloc
push edi
cmp ecx,eax
jc .l1
mov ecx,eax
.l1: push esi
call movedata
pop edi
call free
popad
.l2: ret
free: ;puntero en di
;no se comprueban los punteros
;retorna di=0 , ncr
test edi,edi
jz realloc.l2
pushad
pop edi
mov ebp,[edi-4]
dec ebp
and ebp,-4 ;redondeo a 4,dx=dx-4
xor edx,edx
push edx
mov edx,iniciomemoria+4
mov esi,edx
;buscar puntero libre anterior
.l1: mov ebx,esi
lodsd
add esi,eax
cmp esi,edi
jc .l1
;enlazar
mov ecx,esi
sub ecx,edi
sub eax,ecx
sub ecx,4
mov [ebx],eax
;fusionar con el anterior
cmp eax,[ebx-4]
jne .l2
cmp ebx,edx
je .l2 ;no fusionar con el primero
mov edi,ebx
add eax,4
add ecx,eax
add ebp,eax
.l2: mov ebx,ebp ;fusionar con bloques de tama¤o 0
.l3: add ebx,4
test dword [edi+ebx],-1
jz .l3
cmp ebx,ecx
jne .l4
;fusionar con el siguiente
add ebx,[esi-4]
add ecx,[esi]
add ebx,4
add ecx,4
cmp esi,[edx+4]
jne .l4
mov [edx+4],edi
.l4: mov [edi-4],ebx
mov [edi],ecx
popad
ret
 
add_mem: ;edi,ecx ;el ultimo bloque libre debe ser >8 bytes para poder fragmentarlo
cmp ecx,64
jc .l1
add ecx,edi
add edi,3
and edi,-4
and ecx,-4
mov eax,ecx
sub ecx,edi ;redondeo
xchg eax,[iniciomemoria+12]
cmp edi,eax
jna .l1
lea esi,[edi+4]
mov edx,esi
xchg esi,[iniciomemoria+8]
neg edx
mov [edi],edx
mov [edi+4],edx
lea edx,[edi-4]
sub edi,esi
mov [esi],edi
sub eax,4
sub eax,esi
mov [esi-4],eax
add esi,eax
sub edx,esi
mov [esi],edx
.l1: ret
 
check_mem: ;busqueda de errores en la memoria
;retorna edx nbloques o 0 si error,ecx memoria libre
;ncr: ebp,ebx,eax
mov edi,iniciomemoria
mov esi,edi
xor edx,edx
mov ecx,[edi]
neg ecx ;el primer bloque no cuenta
.l1: add ecx,[edi]
add edi,4
add edi,[edi]
.l2: inc edx
add esi,[esi]
jc .l4
add esi,7
jc .l3
and esi,-4
cmp esi,edi
jc .l2
je .l1
jmp .l4
.l3: test edi,edi
jnz .l4
add ecx,[iniciomemoria+12]
ret
.l4: xor edx,edx
stc
ret
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/keyascii/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm keyascii.asm keyascii
@pause
/programs/keyascii/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm keyascii.asm keyascii
@pause
/programs/keyascii/trunk/keyascii.asm
0,0 → 1,127
; Author: M. Lisovin
; 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 ; just read it and ignore
int 0x40
mov [keyid],ah
call draw_window
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,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+270 ; [x start] *65536 + [x size]
mov ecx,100*65536+80 ; [y start] *65536 + [y size]
mov edx,0x83ffffff ; 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
int 0x40
 
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
not ecx
mov esi,4
add ebx,23
mov edx,tdec
int 0x40
add ebx,23
mov edx,thex
int 0x40
 
mov ecx,[keyid]
mov eax,47
mov ebx,3*65536
mov edx,40*65536+31
mov esi,0x224466
int 0x40
add edx,23
mov bh,1
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
; DATA AREA
 
tdec: db 'DEC:'
thex: db 'HEX:'
labelt:
db 'KEYBOARD ASCIICODES-PRESS ANY KEY'
labellen:dd 0
keyid:db 0
I_END:
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/keyascii/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/launcher/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm launcher.asm launcher
@pause
/programs/launcher/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm launcher.asm launcher
@pause
/programs/launcher/trunk/launcher.asm
0,0 → 1,203
;
; LAUNCHER - €‚’Ž‡€“‘Š Žƒ€ŒŒ
; Š®¤ ¯à®£à ¬¬ë ᮢᥬ ­¥ ®¯â¨¬¨§¨à®¢ ­, ­® ®ç¥­ì ¯à®áâ ¤«ï ¯®­¨¬ ­¨ï.
; â®â « ã­ç¥à £à㧨⠨­ä®à¬ æ¨î ® ¯à®£à ¬¬ å ¤«ï § ¯ã᪠ ¨§ ä ©« 
; AUTORUN.DAT. ”®à¬ â ®ç¥­ì ¯à®áâ ¨ ¢ ª®¬¬¥­â à¨ïå ­¥ ­ã¦¤ ¥âáï.
;
; Š®¬¯¨«¨àã©â¥ á ¯®¬®éìî FASM 1.52 ¨ ¢ëè¥
;
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 0x8000 ; memory for app
dd 0x8000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;include "DEBUG.INC"
 
START: ; start of execution
 
mov eax, 5
mov ebx, 10
int 0x40
 
mov eax, 58 ; load AUTORUN.DAT
mov ebx, autorun_dat_info
int 0x40
 
call get_number
mov [number_of_files], eax
;dps "NUMBER OF FILES: "
;dpd eax
;dps <13,10>
call next_line
 
start_program:
;dps <"STARTING A PROGRAM",13,10>
call clear_strings
mov edi, program
call get_string
mov edi, parameters
call get_string
call get_number
call run_program
call next_line
dec [number_of_files]
jnz start_program
 
exit:
or eax, -1
int 0x40
 
 
run_program: ; time to delay in eax
push eax
mcall 58, start_info
pop ebx
 
mov eax, 5
int 0x40
ret
 
 
clear_strings: ; clears buffers
pushad
 
mov ecx, 60
mov edi, program
xor al, al ;mov al, ' '
rep stosb
 
mov ecx, 60
mov edi, parameters
xor al, al
rep stosb
 
popad
ret
 
 
get_string: ; pointer to destination buffer in edi
pushad
call skip_spaces
mov esi, [position]
;dpd esi
;dps <13,10>
add esi, file_data
.start:
lodsb
cmp al, ' '
je .finish
stosb
inc [position]
jmp .start
.finish:
popad
ret
 
 
get_number:
push ebx esi
call skip_spaces
mov esi, [position]
add esi, file_data
xor eax, eax
xor ebx, ebx
.start:
lodsb
cmp al, '0'
jb .finish
cmp al, '9'
ja .finish
sub al, '0'
imul ebx, 10
add ebx, eax
inc [position]
jmp .start
.finish:
mov eax, ebx
pop esi ebx
ret
 
 
skip_spaces:
pushad
xor eax, eax
mov esi, [position]
add esi, file_data
.start:
lodsb
cmp al, ' '
jne .finish
inc [position]
jmp .start
.finish:
;dps "NOW AL = "
;mov [tmp],al
;mov edx, tmp
;call debug_outstr
;dps <13,10>
popad
ret
 
 
next_line:
pushad
mov esi, [position]
add esi, file_data
.start:
lodsb
cmp al, 13
je .finish
inc [position]
jmp .start
.finish:
add [position], 2
inc esi
lodsb
cmp al, '#'
je .skipline
cmp al, 13
jne .donotskip
.skipline:
call next_line
.donotskip:
popad
ret
 
 
 
; DATA:
position dd 0 ; position in file
 
autorun_dat_info: ; AUTORUN.DAT
.mode dd 0 ; read file
.start_block dd 0 ; block to read
.blocks dd 0x10 ; 16*512 bytes max
.address dd file_data
.workarea dd work_area
db "/RD/1/AUTORUN.DAT",0
 
start_info:
.mode dd 16
dd 0
.params dd parameters
dd 0
.workarea dd work_area
.path: ;      
 
I_END:
 
program rb 61 ; 60 + [0] char
parameters rb 61
 
number_of_files dd ?
 
work_area rb 0x4000
file_data rb 16*512
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/launcher/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/life/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm life.asm life
@pause
/programs/life/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm life.asm life
@pause
/programs/life/trunk/life.asm
0,0 → 1,254
;
; LIFE.ASM
;
; This program displays Conways game of life
;
; Compile with FASM v1.49 for DOS;
;
; Version 0.1a 20th May 2004
; Ivan Poddubny
;
; Version 0.1 30th March 2004
; Mike Hibbett
;
; This is an experiment to see how small a usefull application can get
 
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 0xc1000 ; memory for app
dd 0xc1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;include "DEBUG.INC"
macro setcell x,y { mov [esi + 512*(y)*3 + (x)*3], al }
 
START:
 
mov al, 0xFF
mov esi, I_END
 
; This is the seed pattern.
 
; Life needs a seed pattern, which is 'hardcode' at compile time
; The grid is 512 wide (x direction) by 512 deep (y direction)
; setcell take the arguments setcell x,y
; 0,0 is the top left corner.
 
; setcell 200,120
; setcell 201,120
; setcell 200,121
; setcell 199,121
; setcell 200,122
 
; setcell 70,120
; setcell 71,120
; setcell 70,121
; setcell 69,121
; setcell 70,122
 
mov eax, 40
mov ebx, 100101b
int 0x40
 
call draw_window
 
still:
 
; mov eax, 23 ; wait here for event
; mov ebx, 5
; int 0x40
mov eax, 11
int 0x40
 
test eax, eax
je nokey
cmp eax,1 ; redraw request ?
je red
cmp eax,3 ; button in buffer ?
je button
cmp eax,6
je mouse
 
jmp still
 
 
mouse:
mov eax, 37
mov ebx, 2
int 0x40
test eax, eax
jz still
 
mov eax, 37
mov ebx, 1
int 0x40
sub eax, 5*65536+20
mov ebx, eax
shr eax, 16
and ebx, 0xffff
 
; WRITE COORDINATES
; dpd eax
; dps " "
; dpd ebx
; dps <10,13>
 
cmp ax, 0
js still
cmp bx, 0
js still
 
shl ebx, 9
add ebx, eax
imul ebx, 3
add ebx, I_END
mov [ebx], dword 0xFFFFFFFF
jmp draw
 
red: ; REDRAW WINDOW
call draw_window
jmp still
 
 
nokey:
; cycle life state
 
mov eax,5
mov ebx,5
int 0x40
 
mov esi, I_END + 512*3
 
mov al, 0xFF
 
lifeloop:
mov ah, 0
cmp [esi - 3], al
jne t2
inc ah
t2:
cmp [esi + 3], al
jne t3
inc ah
t3:
cmp [esi - 512*3], al
jne t4
inc ah
t4:
cmp [esi + 512*3], al
jne t5
inc ah
t5:
cmp [esi - 512*3 - 3], al
jne t6
inc ah
t6:
cmp [esi - 512*3 + 3], al
jne t7
inc ah
t7:
cmp [esi + 512*3 - 3], al
jne t8
inc ah
t8:
cmp [esi + 512*3 + 3], al
jne tend
inc ah
 
tend:
; If cell is empty but has 3 neigbours, birth
; If cell is occupied and has 2,3 neigbours, live
; else die
 
cmp ah, 3
jne btest
mov [esi+1], al
jmp nextcell
 
btest:
cmp ah, 2
jne nextcell
cmp [esi], al
jne nextcell
mov [esi+1], al
 
nextcell:
add esi, 3
cmp esi, I_END + 512*512*3
jne lifeloop
 
; copy new generation across
 
 
mov ecx, 512*512*3
mov esi, I_END+1
mov edi, I_END
rep movsb ; copy the data across
 
mov ecx, 512*512
mov esi, I_END
nc1:
mov [esi+2], byte 0
add esi, 3
loop nc1
draw:
mov ebx, I_END
mov ecx, 512*65536+512
mov edx, 5*65536+22
mov eax,7
int 0x40
 
jmp still
 
button: ; BUTTON - only close supported
or eax,-1
int 0x40
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0 ; open window
mov ebx,50*65536+512+9
mov ecx,50*65536+512+22+4
mov edx,0x03000000
int 0x40
 
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,header
mov esi,header.size
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
 
; DATA AREA
 
header db 'Life'
.size = $ - header
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/life/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/local/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm local.asm local
@pause
/programs/local/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm local.asm local
@pause
/programs/local/trunk/local.asm
0,0 → 1,522
;
; Remote processing example (local node)
;
; 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
mov eax,53 ; open socket
mov ebx,0
mov ecx,0x2000 ; local port
mov edx,0x3000 ; remote port
mov esi,dword [host_ip] ; node IP
int 0x40
mov [socketNum], eax
call draw_window ; at first, draw the window
still:
mov eax,23 ; wait here for event
mov ebx,1
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
mov eax, 53 ; get data
mov ebx, 2
mov ecx, [socketNum]
int 0x40
cmp eax, 0
jne read
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 ; button id=1 ?
jnz noclose
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov eax,-1
int 0x40
noclose:
cmp ah,2 ; SEND CODE ?
je send_xcode
cmp ah,3 ; LEFT COORDINATES ?
jne no_left
mov [picture_position],0
mov dword [send_data+15],dword STARTX
mov dword [send_data+19],dword 4
mov esi,send_data
mov edi,I_END
mov ecx,23
cld
rep movsb
mov [I_END+23],dword -20
mov eax,53
mov ebx,4
mov ecx,[socketNum]
mov edx,23 + 4
mov esi,I_END
int 0x40
jmp still
no_left:
cmp ah,4 ; RIGHT COORDINATES ?
jne no_right
mov [picture_position],128
mov dword [send_data+15],dword STARTX
mov dword [send_data+19],dword 4
mov esi,send_data
mov edi,I_END
mov ecx,23
cld
rep movsb
mov [I_END+23],dword -20 + 128
mov eax,53
mov ebx,4
mov ecx,[socketNum]
mov edx,23 + 4
mov esi,I_END
int 0x40
jmp still
no_right:
cmp ah,5 ; SEND EXECUTE ?
je send_execute
jmp still
xx dd 0
yy dd 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SEND CODE TO REMOTE ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
send_xcode:
mov dword [send_data+15],dword 0x80000
mov dword [send_data+19],dword remote_code_end - remote_code_start
mov esi,send_data ; header
mov edi,I_END
mov ecx,23
cld
rep movsb
mov esi,remote_code ; remote_code_start ; data
mov edi,I_END+23
mov ecx,remote_code_end - remote_code_start
cld
rep movsb
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socketNum]
mov edx,23 + remote_code_end - remote_code_start
mov esi,I_END
int 0x40
jmp still
send_execute:
mov dword [execute+15],dword draw_fractal
mov eax,53 ; START EXECUTE AT REMOTE
mov ebx,4
mov ecx,[socketNum]
mov edx,19
mov esi,execute
int 0x40
mov edi,3
jmp still
;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; READ ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
read:
cfr007:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
shl edx,8
mov dl,bl
dec edi
jnz cok
mov edi,3
and edx,0xffffff
mov eax,1
mov ebx,[xx]
mov ecx,[yy]
add ebx,15
add ecx,35
add ebx,[picture_position]
int 0x40
inc [xx]
cmp [xx],dword 128
jb cok
mov [xx],0
inc [yy]
cmp [yy],dword 128
jb cok
mov [yy],0
cok:
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne cfr007 ; yes, so get it
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+286 ; [x start] *65536 + [x size]
mov ecx,60*65536+330 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
mov eax,8 ; SEND CODE
mov ebx,60*65536+160
mov ecx,181*65536+13
mov edx,2
mov esi,0x667788
int 0x40
mov eax,8 ; LEFT
mov ebx,60*65536+75
mov ecx,197*65536+13
mov edx,3
mov esi,0x667788
int 0x40
mov eax,8 ; RIGHT
mov ebx,148*65536+72
mov ecx,197*65536+13
mov edx,4
mov esi,0x667788
int 0x40
mov eax,8 ; SEND EXECUTE
mov ebx,60*65536+160
mov ecx,213*65536+13
mov edx,5
mov esi,0x667788
int 0x40
cld
mov ebx,25*65536+185 ; draw info text with function 4
mov ecx,0x000000
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
text:
db ' 1) SEND CODE '
db ' 2) LEFT RIGHT '
db " 3) SEND 'EXECUTE' "
db ' '
db ' LOCAL : 192.168.1.26 '
db ' REMOTE : 192.168.1.22 '
db ' REMOTE CODE AT THE END OF THIS FILE '
db 'x <- END MARKER, DONT DELETE '
labeltext: db 'CLUSTER LOCAL' ;
lte:
socketNum dd 0x0
host_ip db 192,168,1,22
picture_position dd 0x0
send_data db 'MenuetRemote00' ; 00 header ; -> remote port 0x3000
db 1 ; 14 send
dd 0x0 ; 15 position
dd 0x0 ; 19 size
; 23
execute db 'MenuetRemote00' ; 00 header ; -> remote port 0x3000
db 2 ; 14 execute
dd 0x0 ; 15 position
; 19
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; REMOTE CODE ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
remote_code:
org 0x80000
remote_code_start:
PIXWIDTH equ 129
PIXHEIGHT equ 129
ZOOMLIMIT equ 13
DELTA equ 200
THRESHOLD equ 7
STARTSCALE equ 6
CHAR_COLOR equ 0fh
STARTX dd -20
STARTY dd 10
scaleaddy dd 60
scaleaddx dd 100
draw_fractal:
pusha
movzx ebp,word [STARTX]
movzx edi,word [STARTY]
mov cx, PIXHEIGHT ; height of screen in pixels
sub di,cx ; adjust our Y offset
@@CalcRow:
push cx
mov cx, PIXWIDTH -1 ; width of screen in pixels
sub bp,cx ;
@@CalcPixel:
push cx ; save the column counter on stack
xor cx, cx ; clear out color loop counter
xor bx, bx ; zero i coefficient
xor dx, dx ; zero j coefficient
@@CycleColors:
push dx ; save j value for later
mov ax, bx ; ax = i
sub ax, dx ; ax = i - j
add dx, bx ; dx = i + j
stc ; one additional shift, please
call Shifty ; ax = ((i+j)*(i-j)) shifted right
pop dx ; retrieve our saved value for j
add ax,bp ; account for base offset...
cmp ah,THRESHOLD ; Q: is i &gt; THRESHOLD * 256?
xchg bx,ax ; now swap new i with old i
jg @@draw ; Y: draw this pixel
clc ; no additional shifts here, please
call Shifty ; now dx:ax = old i * j
xchg dx,ax ;
add dx,di ; account for base offset...
inc cl ; increment color
jnz @@CycleColors ; keep going until we're done
@@draw:
xchg ax, cx ; mov color into al
pop cx ; retrieve our column counter
pop dx ; fetch row (column already in cx)
push dx ; must leave a copy on the stack
xor bx,bx ; write to video page zero
call store_pixel
inc bp
loop @@CalcPixel
inc di
pop cx
loop @@CalcRow
call return_data
popa
ret
Shifty:
push cx
db 0b1h
scale db STARTSCALE
adc cl,0
imul dx
xchg ax,dx
shl eax,16
xchg ax,dx
shr eax,cl
pop cx
ret
pixel_pos: dd data_area
store_pixel:
pusha
mov ebx,[pixel_pos]
shl eax,3
and eax,0xff
mov [ebx],eax
add dword [pixel_pos],dword 3
popa
ret
return_data:
mov ecx,128 * 128/16
mov esi,data_area
sd:
pusha
mov eax,53 ; use the socket provided by host
mov ebx,4
mov ecx,[0]
mov edx,3*16
int 0x40
mov eax,5
mov ebx,1
int 0x40
popa
add esi,3*16
loop sd
ret
data_area:
remote_code_end:
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/local/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/magnify/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm magnify.asm magnify
@pause
/programs/magnify/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm magnify.asm magnify
@pause
/programs/magnify/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/magnify/trunk/magnify.asm
0,0 → 1,348
;
; MAGNIFY SCREEN
;
; 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 0x10000 ; required amount of memory
dd 0x10000
dd 0x00000000 ; reserved=no extended header
 
include 'lang.inc'
include 'macros.inc'
scr equ 0x1000
 
 
START: ; start of execution
 
mov esp,0xfff0
 
mov eax,14 ; get screen size
int 0x40
push eax
and eax,0x0000ffff
add eax,1
mov [size_y],eax
pop eax
shr eax,16
add eax,1
mov [size_x],eax
 
mov eax,[size_x]
shr eax,2
mov [cmp_ecx],eax
 
mov eax,[size_x]
xor edx,edx
mov ebx,3
mul ebx
mov [add_esi],eax
 
mov eax,[size_y]
shr eax,2
mov [cmp_edx],eax
 
 
 
call draw_window ; at first, draw the window
 
still:
 
call draw_screen
 
mov eax,23 ; wait here for event with timeout
mov ebx,[delay]
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:
 
cmp ah,2
jnz nosave
call save_screen
nosave:
 
jmp still
 
 
 
save_screen:
 
pusha
 
mov ebx,0
mov edi,0x10000
 
ss1:
 
mov eax,35
int 0x40
 
add ebx,1
 
mov [edi],eax
add edi,3
 
cmp edi,0xFFFF0
jb ss1
 
mov eax,33
mov ebx,filename
mov ecx,0x10000
mov edx,0xEFFF0
mov esi,0
int 0x40
 
popa
 
ret
 
 
filename db 'SCREEN RAW'
 
; *********************************************
; ******* 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 ebx,100*65536+322
mov ecx,100*65536+262 ; [y start] *65536 + [y size]
mov edx,0x0;01111cc ; color of work area RRGGBB
mov esi,0x809977ff ; color of grab bar RRGGBB,8->color glide
mov edi,0x00ffff00 ; 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
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov bx,12 ; [x start] *65536 + [x size]
mov ebx,(322-19)*65536+12
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x22aacc ; button color RRGGBB
int 0x40
 
call draw_screen
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
draw_screen:
 
call draw_magnify
 
ret
 
pusha
 
mov edi,scr
 
mov ecx,0
mov edx,0
 
mov esi,0
 
ds1:
 
mov eax,35
mov ebx,esi
int 0x40
stosd
sub edi,1
 
add esi,4
add ecx,1
cmp ecx,[cmp_ecx] ; 800/4
jb ds1
 
add esi,[add_esi] ; 800*3
mov ecx,0
add edx,1
cmp edx,[cmp_edx] ; 600/4
jb ds1
 
mov eax,7
mov ebx,scr
mov ecx,200*65536+160
mov ecx,[size_x]
shr ecx,2
shl ecx,16
mov cx,word [size_y]
shr cx,2
mov edx,20*65536+35
int 0x40
 
popa
 
call draw_magnify
 
ret
 
 
draw_magnify:
 
pusha
 
mov eax,37
mov ebx,0
int 0x40
 
mov ecx,eax
mov edx,eax
shr ecx,16
and edx,65535
 
sub ecx,39
sub edx,29
 
cmp ecx,3000
jb co1
popa
ret
co1:
cmp edx,3000
jb co2
popa
ret
 
co2:
 
and ecx,2047
and edx,2047
 
mov [m_x],ecx
mov [m_y],edx
 
add ecx,40
add edx,30
 
mov [m_xe],ecx
mov [m_ye],edx
 
mov ecx,[m_x]
mov edx,[m_y]
 
dm1:
 
push edx
mov eax,edx
mul [size_x]
pop edx
add eax,ecx
 
mov ebx,eax
mov eax,35
int 0x40
 
pusha
mov ebx,ecx
sub ebx,[m_x]
mov ecx,edx
sub ecx,[m_y]
shl ebx,3
add ebx,2
shl ebx,16
mov bx,7
shl ecx,3
add ecx,22
shl ecx,16
mov cx,7
 
mov edx,eax
mov eax,13
int 0x40
popa
 
add ecx,1
cmp ecx,[m_xe]
jnz dm1
mov ecx,[m_x]
add edx,1
cmp edx,[m_ye]
jnz dm1
 
popa
 
ret
 
 
 
; DATA AREA
 
m_x dd 100
m_y dd 100
 
m_xe dd 110
m_ye dd 110
 
size_x dd 0
size_y dd 0
 
cmp_ecx dd 0
add_esi dd 0
cmp_edx dd 0
 
delay dd 20
 
labelt:
db 'MAGNIFIER - MOVE MOUSE POINTER'
labellen:
 
 
I_END:
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mblocks/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mblocks.asm mblocks
@pause
/programs/mblocks/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mblocks.asm mblocks
@pause
/programs/mblocks/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mblocks/trunk/mblocks.asm
0,0 → 1,1642
;
; Memory Blocks for Menuet v0.1
; Crown Soft (c) crown_s@rambler.ru
;
; 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 0x4000 ; memory for app
dd 0x4000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'macros.inc'
labelt db 'Memory Blocks for Menuet v0.1 Crown Soft (c)'
labellen:
 
 
 
START: ; start of execution
call initpict
 
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 ?
jz close
 
cmp ah,100 ; button id=100 ?
jz init
 
movzx ebx,ah
 
dec bl
dec bl ; bl -number bitton
mov al,[bitstat+ebx*1]
cmp al,1 ; is pictures on bitton?
jz still
 
inc [nkeydown]
 
cmp [firstbit],0xff
jz tofirst
 
cmp [secondbit],0xff
jz tosecond
 
 
movzx eax,[firstbit]
mov [bitstat+eax*1],0
 
mov al,[secondbit]
mov [bitstat+eax*1],0
 
mov [secondbit],0xff
 
 
tofirst:
mov [firstbit],bl
mov [bitstat+ebx*1],1
call draw_window
jmp still
 
tosecond:
mov [secondbit],bl
mov [bitstat+ebx*1],1
 
mov al,[bitpict+ebx*1]
mov bl,[firstbit] ; comply pictures on first bitton
cmp [bitpict+ebx*1],al ; with pictures on second
jnz tosm1
mov [firstbit] ,0xff
mov [secondbit],0xff
tosm1:
 
call draw_window
jmp still
 
init:
call initpict
jmp still
 
close:
mov eax,-1 ; close 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,100*65536+413 ; [x start] *65536 + [x size]
mov ecx,100*65536+295 ; [y start] *65536 + [y size]
mov edx,0x83000000 ; 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
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,(411-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
; int 0x40
 
; init BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,10*65536+55 ; [x start] *65536 + [x size]
mov ecx,270*65536+12 ; [y start] *65536 + [y size]
mov edx,100 ; button id
mov esi,0x6688dd ; button color RRGGBB
int 0x40
; NEW GAME LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,15*65536+273 ; [x start] *65536 + [y start]
mov ecx,0x00ddeeff ; color of text RRGGBB
mov edx,labnew ; pointer to text beginning
mov esi,labnewlen-labnew ; text length
int 0x40
 
mov ebx,40001h
mov ecx,nkeydown
mov edx,135*65536+273
mov esi,0x00ffffff
mov eax,47
int 0x40
 
 
;--- draw buttons ---
mov [bitid],2
mov ecx,10
drm1:
mov ebx,ecx
mov ecx,6
drm2:
pushad
; BUTTON
imul bx,bx,40
sub bx,30
shl ebx,16
mov bx,34 ; ebx=[x start]*65536+[x size]
 
imul cx,cx,40
sub cx,13
shl ecx,16
mov cx,34 ; ecx=[y start]*65536+[y size]
 
movzx edx,[bitid] ; button id
 
mov esi,[coltbl+16*4] ; button color RRGGBB
mov eax,8 ; function 8 : define and draw button
int 0x40
 
; PICTURE
dec edx
dec edx
; edx - number of bitton
mov al,[bitstat+edx*1]
cmp al,0
jz drm3
movzx eax,[bitpict+edx*1] ; al - number of picture
call unpack
 
mov edx,ebx
shr ecx,16
mov dx,cx ; ecx=[x size]*65536+[y size]
add edx,10001h
 
mov ebx,mas
mov ecx,32*65536+32 ; image size
mov eax,7 ; function 7 : putimage
int 0x40
drm3:
 
inc [bitid]
popad
loop drm2
mov ecx,ebx
loop drm1
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
;========== put pictures number eax to mas ==================================
unpack:
pushad
cld
mov esi,[pict+eax*4]
 
mov edi, mas
 
lodsb ; al - mask color
mov dl,al ; dl - mask color
 
xor ecx,ecx
m2:
xor eax,eax
lodsb
mov cl,al
and cl,0Fh
shr al,4
 
cmp al,dl ; is color mask?
jnz m5
mov al,16
m5:
 
cmp cl,ch ; ch=00h
jz m1
mov eax,[coltbl+eax*4]
m3:
stosd
dec edi
loop m3
jmp m2
 
m1:
 
mov eax,[coltbl+16*4]
m7:
cmp edi,1024*3+mas
jnb m6
stosd
dec edi
jmp m7
 
m6:
popad
ret
;============================================================================
 
;============================= initpict =====================================
initpict:
pushad
mov edi,nkeydown
 
mov ecx,60+4
xor al,al
rep stosb ; nkeydown=0 bitstat=0
 
mov ecx,60+2
mov al,0ffh
rep stosb ; bitpict=0ffh firstbit=0ffh secondbit=0ffh
 
; Initialize RND
mov eax,3
int 0x40 ; eax=00SSMMHH
rol eax,16 ; eax=MMHH00SS - fist random number
 
mov ebx,8088405h
 
mov ecx,30
ck1:
ck2:
mul ebx ; compute next random number
inc eax ; new := 8088405h * old + 1
 
movzx edx,al
and dl,3fh
 
cmp dl,59
ja ck2
 
cmp [bitpict+edx*1],0ffh
jnz ck2
dec cl
mov [bitpict+edx*1],cl
inc cl
 
mul ebx ; compute next random number
inc eax ; new := 8088405h * old + 1
 
ck3:
mul ebx ; compute next random number
inc eax ; new := 8088405h * old + 1
 
movzx edx,al
and dl,3fh
 
cmp dl,59
ja ck3
 
cmp [bitpict+edx*1],0ffh
jnz ck3
dec cl
mov [bitpict+edx*1],cl
inc cl
 
loop ck1
 
call draw_window
popad
ret
 
;======================================================================
;======================== DATA AREA ===================================
;======================================================================
 
 
 
;----------------------- Compressed pictures --------------------------
 
key1 db 1 ; this color will background
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Dh ; each byte is 0CNh
db 005h,01Fh,01Ah,002h,0F1h,071h,0F1h,071h ; there C - color
db 0F1h,002h,01Fh,017h,001h,071h,0F1h,071h ; N - number pixels
db 0F1h,071h,0F1h,071h,0F1h,071h,001h,01Fh ;
db 011h,002h,012h,001h,071h,0F1h,071h,0F1h ; byte 0X0h - end of picture
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,001h
db 01Fh,001h,0F1h,001h,011h,001h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,001h,012h,00Eh,071h,002h,072h,0F1h
db 071h,0F1h,071h,0F1h,071h,003h,071h,0F1h
db 002h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,077h,0F1h
db 071h,0F1h,071h,001h,083h,001h,071h,002h
db 07Fh,074h,0F1h,071h,0F1h,071h,0F1h,001h
db 013h,001h,0F1h,001h,011h,001h,07Fh,074h
db 0F1h,071h,0F1h,071h,001h,013h,001h,071h
db 001h,012h,00Fh,001h,072h,0F1h,071h,0F1h
db 071h,0F1h,071h,003h,071h,0F1h,001h,013h
db 001h,082h,003h,084h,002h,081h,001h,011h
db 001h,072h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,001h,015h,002h,013h,004h
db 011h,002h,012h,001h,071h,0F1h,071h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,001h
db 01Fh,015h,001h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,001h,01Fh,016h,081h
db 002h,0F1h,071h,0F1h,071h,0F1h,002h,081h
db 01Fh,011h,081h,013h,081h,011h,081h,011h
db 005h,011h,081h,011h,081h,01Fh,011h,081h
db 013h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,014h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,012h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,013h,081h,011h,082h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 015h,081h,012h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,013h,081h,011h,081h
db 012h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,014h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,013h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 016h,081h,015h,081h,011h,081h,011h,081h
db 013h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,01Fh,015h
db 081h,011h,081h,011h,081h,011h,081h,011h
db 081h,011h,081h,01Fh,017h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,01Fh,01Bh
db 081h,011h,081h,000h
 
globe db 1
db 01Ch,008h,01Fh,016h,003h,0C2h,0A1h,0C5h
db 003h,01Fh,011h,002h,0A4h,0C5h,0A2h,0C3h
db 002h,01Dh,001h,0A5h,0C4h,0A2h,0C1h,0A1h
db 0C4h,0A1h,001h,01Bh,001h,0A6h,0C4h,0A2h
db 0C1h,0A1h,0C4h,0A2h,001h,019h,001h,0A8h
db 0C1h,0A1h,0C1h,0A4h,0C4h,0A3h,001h,017h
db 001h,0AFh,0C6h,0A3h,001h,015h,001h,0C2h
db 0AEh,0C6h,0A4h,001h,014h,001h,0C2h,0AEh
db 0C7h,0A1h,0C2h,001h,013h,001h,0C3h,0ADh
db 0CBh,0A1h,001h,012h,001h,0C3h,0ADh,0CAh
db 0A2h,001h,012h,001h,0C3h,0A7h,0C1h,0A5h
db 0C9h,0A3h,001h,011h,001h,0C5h,0A6h,0C1h
db 0A2h,0C1h,0A2h,0C9h,0A4h,002h,0C6h,0A3h
db 0C7h,0A2h,0C8h,0A4h,002h,0C6h,0A4h,0C7h
db 0A1h,0C9h,0A3h,002h,0C7h,0A3h,0CFh,0C3h
db 0A2h,002h,0C9h,0A2h,0CFh,0C3h,0A1h,002h
db 0CBh,0A3h,0CFh,0A1h,002h,0CBh,0A3h,0CFh
db 0C1h,002h,0CDh,0A2h,0C1h,0A3h,0CBh,001h
db 011h,001h,0CCh,0AAh,0C6h,001h,012h,001h
db 0CCh,0ABh,0C5h,001h,012h,001h,0CCh,0ABh
db 0C5h,001h,013h,001h,0CBh,0ABh,0C4h,001h
db 014h,001h,0CDh,0A7h,0C6h,001h,015h,001h
db 0CCh,0A7h,0C5h,001h,017h,001h,0CDh,0A4h
db 0C5h,001h,019h,001h,0CCh,0A3h,0C5h,001h
db 01Bh,001h,0CBh,0A3h,0C4h,001h,01Dh,002h
db 0CAh,0A2h,0C2h,002h,01Fh,011h,003h,0C8h
db 003h,01Fh,016h,008h,000h
 
wa db 1
db 01Ch,008h,01Fh,016h,00Eh,01Fh,011h,004h
db 031h,0B8h,031h,004h,01Dh,003h,0BEh,003h
db 01Bh,002h,031h,0B3h,031h,008h,031h,0B3h
db 031h,002h,019h,002h,0B5h,00Ah,0B5h,002h
db 017h,002h,0B6h,00Ah,0B6h,002h,015h,002h
db 031h,0B7h,008h,0B7h,031h,002h,014h,002h
db 0B8h,008h,0B8h,002h,013h,002h,0BAh,006h
db 0BAh,002h,012h,002h,0BAh,006h,0BAh,002h
db 012h,001h,031h,0BBh,004h,0BBh,031h,001h
db 011h,002h,0BFh,0BDh,004h,0BCh,031h,002h
db 031h,0BCh,004h,0BBh,031h,004h,031h,0BBh
db 004h,0BBh,006h,0BBh,004h,0B2h,007h,031h
db 0B1h,006h,0B1h,031h,007h,0B2h,004h,0B2h
db 008h,0B1h,031h,004h,031h,0B1h,008h,0B2h
db 004h,0B2h,008h,031h,0B1h,031h,002h,031h
db 0B1h,031h,008h,0B2h,004h,0B2h,009h,0B6h
db 009h,0B2h,002h,011h,001h,031h,0B2h,007h
db 0B8h,007h,0B2h,031h,001h,012h,002h,0B2h
db 007h,0B8h,007h,0B2h,002h,012h,002h,0B3h
db 005h,0BAh,005h,0B3h,002h,013h,002h,0B3h
db 004h,0BAh,004h,0B3h,002h,014h,002h,031h
db 0B3h,002h,0BCh,002h,0B3h,031h,002h,015h
db 002h,0BFh,0B7h,002h,017h,002h,0BFh,0B5h
db 002h,019h,002h,031h,0BFh,0B1h,031h,002h
db 01Bh,003h,0BEh,003h,01Dh,004h,031h,0B8h
db 031h,004h,01Fh,011h,00Eh,01Fh,016h,008h
db 000h
 
sword db 2
db 02Fh,02Fh,023h,003h,02Fh,02Eh,001h,072h
db 001h,02Fh,02Dh,001h,072h,0F1h,001h,02Fh
db 02Dh,001h,0F1h,071h,0F1h,001h,02Fh,02Dh
db 001h,0F3h,001h,02Fh,02Dh,001h,0F3h,001h
db 02Fh,02Dh,001h,0F3h,001h,02Fh,02Dh,001h
db 0F3h,001h,02Fh,02Dh,001h,0F2h,071h,001h
db 02Fh,02Dh,001h,073h,001h,02Fh,02Dh,001h
db 073h,001h,02Fh,02Dh,001h,073h,001h,02Fh
db 02Dh,001h,073h,001h,02Fh,02Dh,001h,073h
db 001h,02Fh,02Dh,001h,072h,081h,001h,02Fh
db 02Dh,001h,083h,001h,02Fh,02Dh,001h,083h
db 001h,02Fh,02Dh,001h,083h,001h,02Fh,02Dh
db 001h,083h,001h,024h,001h,02Fh,028h,001h
db 083h,001h,022h,001h,02Fh,02Ah,001h,083h
db 002h,02Fh,02Ch,001h,082h,002h,02Fh,02Dh
db 002h,032h,001h,02Fh,02Ch,002h,031h,011h
db 0B1h,001h,02Fh,02Ah,001h,022h,001h,0B1h
db 031h,071h,001h,02Fh,028h,001h,024h,001h
db 071h,031h,0F1h,001h,02Fh,02Dh,001h,0F3h
db 001h,02Fh,02Dh,001h,0F2h,001h,02Fh,02Eh
db 002h,000h
 
cow db 1
db 018h,004h,01Fh,01Ch,004h,01Ch,003h,01Ch
db 001h,0B2h,001h,01Eh,002h,01Bh,002h,0B1h
db 001h,01Fh,003h,01Ah,001h,0B2h,001h,01Fh
db 001h,0B1h,001h,01Ah,001h,0B2h,001h,015h
db 004h,016h,001h,0B1h,001h,01Ah,001h,0B2h
db 002h,012h,003h,0F2h,002h,014h,002h,0B1h
db 001h,01Ah,002h,0B3h,003h,0F3h,071h,0F1h
db 006h,0B2h,001h,01Bh,001h,0B4h,001h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F2h,002h,0B4h
db 001h,01Bh,002h,0B3h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F2h,001h,0B4h,001h
db 01Ch,001h,0B1h,004h,071h,0F1h,071h,004h
db 071h,0F1h,001h,0B2h,002h,018h,006h,0E2h
db 005h,0E2h,003h,071h,001h,0B1h,002h,017h
db 002h,0F5h,001h,0E2h,003h,0F1h,001h,0E2h
db 003h,071h,005h,016h,001h,0F3h,002h,0F2h
db 004h,0F1h,071h,0F1h,004h,072h,001h,074h
db 001h,015h,003h,0F2h,003h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,075h
db 002h,071h,002h,017h,003h,0F1h,001h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 074h,002h,073h,002h,01Ah,001h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,075h
db 006h,01Ah,002h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,074h,002h,01Eh
db 001h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,076h,001h,01Dh,001h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,074h,003h,01Ch,001h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 071h,0F1h,075h,001h,0F1h,001h,01Ch,001h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 071h,0F1h,076h,001h,0F1h,001h,01Ch,001h
db 072h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 077h,003h,01Ch,001h,07Fh,071h,001h,0F1h
db 001h,01Ch,001h,073h,003h,072h,003h,0F1h
db 074h,001h,0F1h,001h,01Ch,002h,072h,003h
db 072h,003h,075h,003h,01Dh,002h,07Dh,001h
db 0F2h,001h,01Eh,002h,07Bh,003h,0F1h,001h
db 01Fh,003h,077h,003h,0F2h,001h,01Fh,013h
db 003h,073h,003h,0F2h,002h,01Fh,016h,009h
db 000h
 
mace db 1
db 01Fh,01Fh,01Bh,081h,01Fh,01Fh,011h,082h
db 01Ah,081h,01Fh,014h,081h,0F1h,081h,018h
db 082h,01Fh,014h,081h,0F1h,071h,085h,012h
db 081h,0F1h,081h,01Fh,013h,082h,0F1h,071h
db 081h,004h,082h,0F1h,071h,081h,01Fh,012h
db 081h,002h,082h,006h,081h,072h,081h,01Fh
db 011h,081h,00Ch,082h,01Fh,011h,081h,00Fh
db 001h,01Bh,085h,008h,082h,007h,01Bh,081h
db 0F1h,072h,081h,006h,081h,0F1h,071h,081h
db 006h,01Ch,081h,0F1h,071h,081h,006h,081h
db 072h,081h,006h,085h,017h,082h,0F1h,008h
db 082h,006h,081h,0F3h,081h,018h,081h,00Fh
db 003h,081h,072h,081h,019h,081h,005h,082h
db 00Ch,082h,01Ah,081h,004h,081h,0F1h,071h
db 081h,003h,082h,007h,01Bh,081h,004h,081h
db 072h,081h,002h,081h,072h,081h,006h,01Bh
db 082h,004h,082h,003h,081h,0F1h,071h,081h
db 006h,013h,082h,015h,081h,0F1h,071h,081h
db 009h,081h,0F1h,081h,005h,011h,083h,0B1h
db 081h,001h,013h,081h,0F1h,072h,081h,00Ah
db 082h,002h,082h,001h,081h,0B1h,004h,0B1h
db 001h,011h,086h,00Bh,081h,001h,081h,072h
db 081h,003h,013h,082h,001h,016h,004h,082h
db 007h,081h,0F1h,071h,081h,016h,081h,0B1h
db 001h,017h,002h,081h,0F1h,071h,081h,007h
db 081h,0F1h,081h,015h,082h,002h,018h,001h
db 081h,0F1h,071h,081h,006h,012h,082h,015h
db 081h,0B1h,001h,01Ah,081h,0F1h,081h,005h
db 015h,081h,013h,082h,003h,01Ah,082h,01Fh
db 081h,0B1h,001h,01Ch,081h,01Fh,081h,003h
db 01Fh,01Ch,081h,0B1h,001h,01Fh,01Eh,081h
db 002h,01Fh,01Eh,082h,001h,01Fh,01Eh,081h
db 0B1h,001h,01Fh,01Fh,001h,000h
 
cube db 1
db 01Dh,00Ah,01Fh,016h,001h,0C8h,002h,01Fh
db 015h,001h,0C8h,001h,0A1h,001h,01Fh,014h
db 001h,0C8h,001h,0A2h,001h,01Fh,013h,00Ah
db 0A3h,001h,01Fh,013h,001h,098h,001h,0A3h
db 005h,01Eh,001h,098h,001h,0A3h,001h,0C2h
db 002h,01Eh,001h,098h,001h,0A3h,001h,0C1h
db 001h,0A1h,001h,01Eh,001h,098h,001h,0A3h
db 002h,0A2h,001h,019h,006h,098h,001h,0A3h
db 00Ah,013h,001h,0C5h,001h,098h,001h,0A2h
db 001h,0C8h,002h,012h,001h,0C6h,001h,098h
db 001h,0A1h,001h,0C8h,001h,0A1h,001h,011h
db 001h,0C7h,001h,098h,002h,0C8h,001h,0A2h
db 00Fh,00Eh,0A3h,002h,097h,001h,0C8h,002h
db 098h,001h,0A3h,002h,096h,001h,0C8h,001h
db 0A1h,001h,098h,001h,0A3h,002h,095h,001h
db 0C8h,001h,0A2h,001h,098h,001h,0A3h,002h
db 094h,00Ah,0A3h,001h,098h,001h,0A3h,002h
db 094h,001h,098h,001h,0A3h,001h,098h,001h
db 0A3h,002h,094h,001h,098h,001h,0A3h,001h
db 098h,001h,0A2h,001h,011h,001h,094h,001h
db 098h,001h,0A3h,001h,098h,001h,0A1h,001h
db 012h,001h,094h,001h,098h,001h,0A3h,001h
db 098h,002h,013h,006h,098h,001h,0A3h,00Ah
db 019h,001h,098h,001h,0A2h,002h,0A3h,001h
db 01Eh,001h,098h,001h,0A1h,001h,091h,001h
db 0A3h,001h,01Eh,001h,098h,002h,092h,001h
db 0A3h,001h,01Eh,00Ah,093h,001h,0A3h,001h
db 01Fh,013h,001h,098h,001h,0A3h,001h,01Fh
db 013h,001h,098h,001h,0A2h,001h,01Fh,014h
db 001h,098h,001h,0A1h,001h,01Fh,015h,001h
db 098h,002h,01Fh,016h,00Ah,000h
 
ball db 1
db 01Fh,01Fh,01Eh,082h,004h,081h,01Fh,018h
db 083h,008h,01Fh,014h,082h,0F2h,071h,0F1h
db 071h,081h,001h,084h,002h,01Fh,011h,082h
db 0F4h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 083h,001h,01Eh,081h,001h,0F6h,071h,0F1h
db 071h,0F1h,071h,0F1h,071h,083h,001h,01Ch
db 081h,002h,0F7h,071h,0F1h,071h,0F1h,073h
db 083h,001h,01Bh,002h,081h,0F5h,071h,081h
db 0F1h,071h,0F1h,073h,081h,071h,081h,002h
db 01Ah,081h,001h,081h,0F5h,081h,002h,081h
db 0F1h,071h,0F1h,073h,082h,003h,019h,081h
db 001h,0F4h,071h,081h,004h,081h,0F1h,073h
db 081h,071h,004h,019h,081h,071h,0F4h,081h
db 006h,081h,072h,081h,071h,081h,005h,017h
db 081h,071h,0F5h,071h,006h,081h,073h,082h
db 005h,017h,081h,0F1h,071h,0F3h,071h,0F1h
db 006h,081h,072h,081h,071h,081h,005h,017h
db 081h,071h,0F3h,071h,0F1h,071h,081h,004h
db 081h,072h,081h,071h,083h,004h,017h,081h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,072h
db 083h,074h,085h,001h,081h,001h,017h,082h
db 0F1h,071h,0F1h,071h,0F1h,079h,081h,071h
db 086h,001h,017h,083h,072h,0F1h,077h,081h
db 071h,081h,071h,087h,001h,018h,081h,003h
db 079h,081h,071h,087h,001h,019h,081h,003h
db 076h,081h,071h,081h,071h,081h,071h,086h
db 001h,01Ah,004h,074h,081h,071h,081h,071h
db 004h,084h,001h,01Bh,081h,003h,071h,081h
db 071h,081h,071h,081h,071h,006h,083h,001h
db 01Ch,081h,002h,081h,071h,081h,071h,081h
db 071h,007h,082h,001h,01Eh,001h,081h,071h
db 081h,071h,081h,071h,081h,006h,082h,001h
db 01Fh,011h,002h,071h,081h,071h,082h,005h
db 081h,002h,021h,0A1h,01Dh,0A4h,002h,087h
db 002h,024h,0A1h,01Ah,0A6h,022h,007h,025h
db 0A1h,021h,0A1h,018h,0A7h,021h,0A1h,02Bh
db 081h,021h,0A2h,018h,0A8h,021h,0A1h,021h
db 0A1h,021h,081h,021h,081h,021h,081h,021h
db 0A1h,021h,0A1h,021h,0A1h,019h,0A8h,021h
db 0A1h,021h,0A1h,021h,0A1h,021h,0A1h,021h
db 0A1h,021h,0A1h,021h,0A1h,01Ch,0A9h,021h
db 0A1h,021h,0A1h,021h,0A1h,021h,0A1h,021h
db 0A1h,01Fh,011h,0AEh,000h
 
dish db 1
db 019h,091h,01Fh,01Ch,091h,013h,091h,01Dh
db 084h,01Bh,091h,012h,091h,01Bh,082h,0F3h
db 071h,001h,018h,091h,012h,091h,01Bh,082h
db 0F2h,083h,0F1h,001h,019h,091h,013h,082h
db 017h,081h,0F2h,085h,0F1h,001h,01Ah,091h
db 011h,082h,0F1h,001h,015h,081h,0F1h,086h
db 0F1h,002h,017h,092h,013h,083h,0F1h,001h
db 013h,081h,0F1h,087h,0F1h,002h,01Ah,091h
db 012h,005h,011h,081h,0F1h,087h,0F1h,001h
db 081h,001h,019h,091h,017h,002h,0F1h,088h
db 0F1h,001h,081h,001h,018h,091h,018h,003h
db 087h,0F1h,001h,082h,001h,01Fh,011h,081h
db 0F1h,081h,002h,086h,0F1h,001h,081h,001h
db 01Fh,011h,081h,0F1h,083h,002h,084h,0F1h
db 001h,082h,001h,01Fh,081h,0F1h,085h,002h
db 082h,0F1h,001h,083h,001h,01Eh,081h,0F1h
db 087h,002h,0F1h,001h,081h,071h,081h,001h
db 01Eh,081h,0F1h,089h,0F1h,001h,081h,072h
db 081h,001h,01Dh,081h,0F1h,089h,0F1h,001h
db 081h,072h,082h,001h,01Dh,081h,0F1h,088h
db 0F1h,001h,081h,073h,081h,001h,01Dh,081h
db 0F1h,088h,0F1h,001h,081h,074h,081h,003h
db 01Ah,081h,0F1h,088h,0F1h,001h,081h,074h
db 081h,002h,071h,081h,001h,019h,081h,0F1h
db 087h,0F1h,001h,081h,074h,081h,002h,072h
db 081h,001h,018h,081h,0F1h,087h,0F1h,001h
db 081h,074h,081h,002h,072h,082h,001h,018h
db 081h,0F1h,085h,0F2h,001h,081h,073h,081h
db 003h,073h,081h,001h,01Ah,081h,0F5h,002h
db 072h,081h,004h,074h,081h,001h,01Ch,00Ah
db 012h,001h,073h,082h,001h,01Fh,019h,001h
db 072h,083h,001h,01Fh,019h,001h,085h,001h
db 01Fh,019h,001h,085h,001h,01Fh,014h,085h
db 00Ch,01Eh,081h,0F1h,07Fh,081h,001h,01Ch
db 001h,08Fh,084h,001h,01Ch,00Fh,004h,000h
 
flag db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,012h,006h,01Fh
db 019h,009h,01Fh,016h,007h,0F2h,004h,01Fh
db 013h,008h,0F3h,003h,016h,002h,018h,003h
db 0F1h,006h,0F5h,004h,013h,002h,015h,004h
db 0F3h,006h,0F6h,008h,015h,002h,0F5h,006h
db 0F6h,008h,015h,007h,0F6h,006h,0F6h,002h
db 015h,007h,0F6h,006h,0F6h,002h,015h,007h
db 0F6h,006h,0F6h,002h,015h,007h,0F6h,006h
db 0F6h,002h,015h,007h,0F6h,006h,0F6h,002h
db 015h,007h,0F6h,006h,0F6h,002h,015h,002h
db 0F5h,006h,0F6h,008h,015h,002h,0F5h,006h
db 0F6h,008h,015h,002h,0F5h,009h,0F3h,008h
db 015h,002h,0F3h,00Dh,0F1h,008h,015h,002h
db 0F2h,006h,016h,00Bh,015h,006h,01Bh,004h
db 0F4h,002h,015h,004h,01Eh,009h,015h,003h
db 01Fh,012h,007h,01Fh,01Fh,002h,01Fh,01Fh
db 002h,01Fh,01Fh,002h,01Fh,01Fh,002h,01Fh
db 01Fh,002h,01Fh,01Fh,002h,01Fh,01Fh,002h
db 000h
 
apple db 4
db 04Fh,04Fh,04Fh,04Fh,04Ah,024h,04Fh,04Ah
db 023h,0A1h,021h,082h,001h,04Fh,04Ah,021h
db 0A3h,021h,081h,021h,001h,04Fh,04Ah,023h
db 0A2h,022h,001h,04Fh,04Ah,022h,0A1h,021h
db 082h,001h,043h,031h,001h,04Fh,047h,021h
db 0A1h,082h,021h,001h,041h,031h,0B1h,001h
db 04Fh,048h,022h,0A1h,021h,002h,0B1h,001h
db 04Fh,04Bh,023h,031h,071h,001h,015h,04Fh
db 044h,012h,092h,011h,031h,071h,001h,093h
db 014h,04Fh,041h,011h,091h,0F1h,071h,091h
db 012h,002h,0D2h,071h,092h,012h,001h,04Eh
db 011h,091h,0F1h,073h,0D7h,072h,091h,012h
db 001h,04Ch,011h,091h,0F3h,092h,077h,094h
db 012h,001h,04Bh,011h,091h,0F1h,091h,0F1h
db 071h,09Dh,011h,001h,04Bh,011h,091h,0F1h
db 092h,073h,09Bh,011h,001h,04Ch,013h,09Fh
db 012h,001h,04Bh,031h,071h,0F1h,012h,09Dh
db 012h,001h,04Ch,031h,071h,0F1h,0B1h,011h
db 09Ch,012h,001h,04Ch,031h,071h,0B1h,071h
db 011h,09Ch,012h,001h,04Dh,031h,071h,0F1h
db 071h,011h,09Bh,012h,001h,04Dh,031h,071h
db 0B1h,071h,011h,09Bh,012h,001h,04Dh,031h
db 071h,0F1h,071h,011h,09Bh,012h,001h,04Dh
db 031h,071h,0B1h,071h,011h,09Bh,011h,001h
db 04Dh,031h,071h,0F1h,071h,011h,09Ch,011h
db 001h,04Ch,031h,073h,011h,09Ch,011h,001h
db 04Dh,014h,09Dh,011h,001h,04Eh,011h,09Eh
db 011h,001h,04Fh,041h,011h,09Bh,012h,001h
db 04Fh,043h,012h,098h,011h,002h,04Fh,046h
db 009h,000h
 
ok db 1
db 01Fh,01Fh,01Eh,007h,01Fh,017h,003h,027h
db 003h,01Fh,012h,002h,02Dh,002h,01Eh,001h
db 02Fh,022h,001h,01Ch,001h,02Fh,024h,001h
db 01Ah,001h,02Fh,026h,001h,018h,001h,02Fh
db 028h,001h,017h,001h,02Fh,028h,001h,081h
db 015h,001h,02Fh,021h,0F4h,025h,001h,081h
db 014h,001h,02Fh,071h,0F3h,071h,025h,001h
db 081h,014h,001h,02Fh,0F4h,026h,001h,082h
db 012h,001h,02Fh,071h,0F3h,071h,027h,001h
db 081h,012h,001h,02Fh,0F4h,028h,001h,081h
db 012h,001h,02Eh,071h,0F3h,071h,028h,001h
db 082h,011h,001h,02Eh,0F4h,029h,001h,082h
db 011h,001h,027h,0F3h,071h,022h,071h,0F3h
db 071h,029h,001h,082h,011h,001h,027h,071h
db 0F3h,071h,021h,0F4h,02Ah,001h,082h,011h
db 001h,028h,071h,0F3h,071h,0F3h,071h,02Ah
db 001h,082h,012h,001h,028h,071h,0F6h,02Ah
db 001h,083h,012h,001h,029h,071h,0F4h,071h
db 02Ah,001h,083h,012h,001h,02Ah,071h,0F3h
db 02Bh,001h,082h,014h,001h,02Ah,071h,0F1h
db 071h,02Ah,001h,083h,014h,001h,02Fh,028h
db 001h,083h,015h,001h,02Fh,026h,001h,083h
db 017h,001h,02Fh,024h,001h,084h,018h,001h
db 02Fh,022h,001h,084h,01Ah,002h,02Dh,002h
db 084h,01Ch,081h,003h,027h,003h,085h,01Eh
db 083h,007h,087h,01Fh,012h,08Dh,01Fh,017h
db 087h,000h
 
speaker db 1
db 016h,08Fh,084h,01Ch,08Fh,086h,01Ah,081h
db 07Fh,076h,081h,019h,081h,071h,008h,083h
db 009h,081h,019h,081h,071h,007h,081h,003h
db 081h,008h,081h,019h,081h,071h,006h,081h
db 005h,081h,007h,081h,019h,081h,071h,006h
db 081h,001h,081h,001h,081h,001h,081h,007h
db 081h,019h,081h,071h,006h,081h,001h,081h
db 071h,081h,001h,081h,007h,081h,019h,081h
db 071h,007h,081h,003h,081h,008h,081h,019h
db 081h,071h,008h,083h,009h,081h,019h,081h
db 071h,00Fh,005h,081h,019h,081h,071h,007h
db 081h,003h,081h,008h,081h,019h,081h,071h
db 006h,081h,005h,081h,007h,081h,019h,081h
db 071h,006h,081h,001h,081h,001h,081h,001h
db 081h,007h,081h,019h,081h,071h,006h,081h
db 001h,081h,071h,081h,001h,081h,007h,081h
db 019h,081h,071h,007h,081h,003h,081h,008h
db 081h,019h,081h,071h,008h,083h,009h,081h
db 019h,081h,071h,00Fh,005h,081h,019h,081h
db 071h,005h,089h,006h,081h,019h,081h,071h
db 004h,081h,009h,081h,005h,081h,019h,081h
db 071h,003h,081h,00Bh,081h,004h,081h,019h
db 081h,071h,002h,081h,005h,081h,071h,081h
db 002h,081h,002h,081h,003h,081h,019h,081h
db 071h,002h,081h,002h,081h,001h,081h,003h
db 081h,002h,081h,001h,081h,003h,081h,019h
db 081h,071h,002h,081h,001h,081h,008h,081h
db 002h,081h,003h,081h,019h,081h,071h,002h
db 081h,002h,083h,003h,082h,001h,081h,001h
db 081h,003h,081h,019h,081h,071h,002h,081h
db 001h,082h,072h,081h,002h,072h,081h,002h
db 081h,003h,081h,019h,081h,071h,002h,081h
db 001h,081h,071h,0F1h,071h,003h,081h,0F1h
db 071h,081h,001h,081h,003h,081h,019h,081h
db 071h,003h,081h,001h,0F1h,071h,081h,004h
db 071h,0F1h,001h,081h,004h,081h,019h,081h
db 071h,004h,081h,009h,081h,005h,081h,019h
db 081h,071h,005h,089h,006h,081h,019h,081h
db 071h,00Fh,005h,081h,019h,08Fh,088h,000h
 
print db 1
db 01Fh,01Fh,01Fh,01Fh,01Dh,00Fh,001h,01Fh
db 011h,001h,0FEh,001h,01Fh,082h,0FDh,082h
db 01Fh,001h,0F2h,0C3h,0F9h,001h,01Fh,011h
db 001h,0FEh,001h,01Fh,011h,001h,0F2h,0C9h
db 0F3h,001h,01Ch,005h,0FEh,005h,014h,002h
db 011h,001h,074h,001h,0F2h,0CAh,0F2h,001h
db 081h,073h,001h,011h,003h,0F1h,002h,0F4h
db 001h,0FEh,001h,071h,0F3h,002h,0F1h,002h
db 0F1h,081h,001h,082h,005h,0F3h,084h,0F3h
db 005h,082h,001h,081h,0F1h,002h,081h,002h
db 081h,001h,0F1h,0B1h,0F1h,0B1h,0F1h,001h
db 0F1h,081h,0F4h,081h,0F1h,001h,0B1h,0F1h
db 0B1h,0F1h,031h,001h,081h,002h,081h,003h
db 011h,002h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,001h,076h,001h,0B1h,0F1h,0B1h,0F1h
db 0B1h,0F1h,031h,002h,011h,002h,013h,002h
db 0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h
db 006h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 031h,002h,017h,001h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,031h,001h,018h,001h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,031h,001h,018h,001h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,031h,001h,018h,001h,0B1h
db 0F1h,001h,0F2h,001h,0F2h,001h,0F2h,001h
db 0F2h,001h,0F2h,001h,0F2h,001h,031h,001h
db 017h,001h,0B1h,00Fh,006h,0B1h,031h,001h
db 015h,001h,0B1h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,031h,001h,013h,001h,0B1h
db 0F1h,00Fh,009h,0B1h,031h,001h,011h,001h
db 0B1h,0F3h,001h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,031h,002h,0F1h,0B1h,00Fh
db 00Ch,031h,002h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 031h,002h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,031h
db 002h,03Fh,03Fh,001h,011h,00Fh,00Fh,012h
db 001h,0F1h,082h,001h,01Fh,013h,001h,0F1h
db 082h,001h,015h,003h,01Fh,015h,003h,000h
 
light db 1
db 01Dh,086h,01Fh,019h,082h,0F5h,071h,081h
db 001h,01Fh,016h,081h,071h,0B3h,0F4h,071h
db 081h,001h,01Fh,014h,081h,071h,0B2h,0F7h
db 071h,081h,001h,01Fh,012h,081h,071h,0B1h
db 0F9h,071h,082h,001h,01Fh,081h,071h,0B1h
db 0F1h,0B2h,0F7h,0B1h,071h,082h,001h,01Eh
db 081h,071h,0B1h,0F1h,0B2h,0F8h,0B1h,071h
db 081h,001h,081h,01Ch,081h,071h,0F1h,0B1h
db 0F1h,0B6h,0F4h,0B1h,071h,082h,001h,01Ch
db 081h,071h,0B3h,0F1h,0B1h,0F8h,0B1h,071h
db 082h,001h,01Ch,081h,071h,0B1h,0F1h,0B1h
db 0FAh,0B1h,071h,082h,001h,01Ch,081h,071h
db 0B1h,0F1h,0B1h,0FBh,071h,082h,001h,01Ch
db 081h,071h,0B1h,0F1h,0B1h,0FBh,071h,082h
db 001h,01Ch,081h,071h,0F2h,0B1h,0FBh,071h
db 082h,001h,01Ch,081h,071h,0F2h,0B1h,072h
db 081h,0F5h,081h,0F2h,071h,082h,001h,01Dh
db 081h,071h,0F1h,0B1h,081h,0F2h,081h,0F3h
db 082h,0F1h,071h,082h,001h,01Fh,081h,071h
db 0F1h,081h,0F1h,0B1h,081h,0F3h,082h,0F1h
db 071h,081h,001h,081h,01Fh,081h,071h,0F1h
db 081h,0F1h,0B1h,081h,0F3h,071h,081h,071h
db 082h,001h,01Fh,012h,081h,072h,082h,0F1h
db 071h,081h,071h,081h,0F1h,071h,081h,001h
db 01Fh,014h,081h,071h,0F3h,081h,0F1h,081h
db 0F1h,071h,081h,001h,01Fh,016h,081h,071h
db 0F1h,082h,0F2h,071h,081h,001h,01Fh,017h
db 081h,071h,0F2h,071h,081h,0F1h,071h,081h
db 001h,01Fh,018h,081h,071h,0F1h,081h,0F1h
db 071h,081h,001h,01Fh,019h,081h,071h,0F1h
db 081h,0F1h,071h,081h,001h,01Fh,019h,081h
db 071h,0F1h,081h,0F1h,071h,081h,001h,01Fh
db 019h,081h,071h,0F1h,081h,0F1h,071h,081h
db 001h,01Fh,019h,031h,071h,0F1h,081h,0F1h
db 071h,081h,001h,01Fh,019h,033h,0F2h,071h
db 002h,01Fh,019h,031h,0F1h,0B1h,003h,031h
db 001h,01Fh,019h,031h,0B1h,031h,0B1h,071h
db 031h,002h,01Fh,019h,031h,0F1h,0B1h,031h
db 002h,031h,001h,01Fh,01Ah,001h,031h,0B1h
db 071h,031h,001h,01Fh,01Ch,004h,000h
 
foto db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh
db 01Fh,017h,004h,01Fh,01Ch,001h,0F3h,081h
db 001h,01Fh,014h,002h,081h,013h,001h,074h
db 001h,081h,001h,012h,004h,081h,019h,002h
db 0F1h,081h,004h,076h,004h,0F3h,081h,003h
db 016h,001h,071h,003h,081h,072h,001h,086h
db 001h,081h,071h,005h,081h,072h,001h,014h
db 001h,0FFh,0F9h,071h,081h,001h,013h,001h
db 0F1h,07Fh,079h,082h,001h,013h,001h,0F1h
db 079h,005h,07Ah,082h,001h,013h,001h,0F1h
db 077h,002h,074h,0F1h,002h,078h,081h,002h
db 013h,009h,081h,0F5h,073h,00Bh,013h,001h
db 082h,001h,081h,001h,081h,001h,081h,075h
db 0F2h,071h,082h,001h,081h,001h,081h,001h
db 081h,002h,081h,001h,013h,001h,081h,001h
db 081h,001h,081h,001h,072h,005h,072h,082h
db 001h,081h,001h,081h,001h,081h,001h,081h
db 003h,013h,001h,082h,001h,081h,001h,071h
db 081h,001h,085h,001h,081h,071h,001h,081h
db 003h,081h,001h,081h,002h,081h,001h,013h
db 001h,081h,001h,081h,001h,081h,071h,001h
db 082h,071h,0F1h,071h,082h,001h,071h,081h
db 003h,081h,001h,081h,001h,081h,003h,013h
db 001h,082h,002h,071h,001h,082h,071h,0F1h
db 085h,001h,071h,004h,081h,001h,081h,002h
db 081h,001h,013h,001h,081h,001h,081h,001h
db 071h,001h,082h,0F1h,071h,085h,001h,071h
db 003h,081h,001h,081h,001h,081h,003h,013h
db 001h,082h,002h,071h,001h,082h,0F1h,086h
db 001h,071h,004h,081h,001h,081h,002h,081h
db 001h,013h,001h,081h,001h,081h,001h,071h
db 001h,082h,071h,086h,001h,071h,003h,081h
db 001h,081h,001h,081h,003h,013h,001h,082h
db 002h,071h,001h,089h,001h,071h,002h,081h
db 001h,081h,001h,081h,002h,081h,001h,013h
db 001h,081h,001h,081h,001h,081h,071h,001h
db 087h,001h,071h,081h,001h,081h,001h,081h
db 001h,081h,001h,081h,003h,013h,001h,082h
db 001h,081h,001h,071h,081h,001h,085h,001h
db 081h,071h,001h,081h,001h,081h,001h,081h
db 001h,081h,003h,015h,002h,081h,001h,081h
db 001h,072h,005h,072h,001h,081h,001h,081h
db 001h,081h,001h,081h,001h,081h,001h,017h
db 006h,081h,075h,081h,00Bh,01Eh,081h,005h
db 081h,000h
 
flop db 1
db 011h,00Fh,00Dh,013h,001h,073h,001h,0FFh
db 0F5h,001h,073h,001h,012h,001h,073h,001h
db 0FFh,0F5h,001h,073h,001h,081h,011h,001h
db 073h,001h,0FFh,0F5h,001h,071h,001h,071h
db 001h,082h,001h,073h,001h,0FFh,0F5h,001h
db 071h,001h,071h,001h,082h,001h,073h,001h
db 0FFh,0F5h,001h,073h,001h,082h,001h,073h
db 001h,0FFh,0F5h,001h,073h,001h,082h,001h
db 073h,001h,0FFh,0F5h,001h,073h,001h,082h
db 001h,073h,001h,0FFh,0F5h,001h,073h,001h
db 082h,001h,073h,001h,0FFh,0F5h,001h,073h
db 001h,082h,001h,073h,001h,0FFh,0F5h,001h
db 073h,001h,082h,001h,073h,001h,0FFh,0F5h
db 001h,073h,001h,082h,001h,073h,001h,0FFh
db 0F5h,001h,073h,001h,082h,001h,073h,001h
db 0FFh,0F5h,001h,073h,001h,082h,001h,073h
db 001h,0FFh,0F5h,001h,073h,001h,082h,001h
db 073h,001h,0FFh,0F5h,001h,073h,001h,082h
db 001h,073h,00Fh,007h,073h,001h,082h,001h
db 07Fh,07Dh,001h,082h,001h,07Fh,07Dh,001h
db 082h,001h,07Fh,07Dh,001h,082h,001h,077h
db 00Fh,003h,073h,001h,082h,001h,077h,001h
db 08Ch,001h,073h,001h,073h,001h,082h,001h
db 077h,001h,082h,004h,086h,001h,073h,001h
db 073h,001h,082h,001h,077h,001h,082h,001h
db 072h,001h,086h,001h,073h,001h,073h,001h
db 082h,001h,077h,001h,082h,001h,072h,001h
db 086h,001h,073h,001h,073h,001h,082h,001h
db 077h,001h,082h,001h,072h,001h,086h,001h
db 073h,001h,073h,001h,082h,001h,077h,001h
db 082h,001h,072h,001h,086h,001h,073h,001h
db 073h,001h,082h,001h,077h,001h,082h,004h
db 086h,001h,073h,001h,073h,001h,082h,011h
db 001h,076h,001h,08Ch,001h,073h,001h,073h
db 001h,082h,012h,00Fh,00Ch,083h,012h,08Fh
db 08Fh,013h,08Fh,08Dh,000h
 
pillar db 1
db 016h,08Fh,084h,01Bh,082h,0FFh,0F4h,082h
db 018h,081h,0F2h,073h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,075h,001h,017h,081h,0F1h,071h,083h
db 07Dh,083h,0F1h,071h,001h,016h,081h,0F1h
db 071h,081h,0F3h,001h,071h,081h,071h,081h
db 071h,081h,071h,081h,071h,081h,071h,001h
db 0F3h,081h,0F1h,071h,001h,015h,081h,0F1h
db 071h,081h,073h,0F1h,001h,089h,001h,071h
db 0F1h,072h,081h,0F1h,071h,001h,015h,081h
db 0F1h,071h,081h,071h,0F1h,081h,0F1h,00Bh
db 0F1h,081h,072h,081h,0F1h,071h,001h,016h
db 081h,0F1h,071h,082h,071h,0F1h,001h,0F7h
db 072h,001h,071h,0F1h,082h,0F1h,071h,001h
db 017h,081h,0F1h,071h,0F2h,071h,0F1h,001h
db 071h,081h,0F1h,071h,081h,0F1h,071h,081h
db 071h,001h,072h,0F2h,072h,001h,018h,001h
db 0F1h,073h,001h,0F1h,071h,081h,0F1h,071h
db 081h,0F1h,071h,081h,071h,081h,001h,074h
db 001h,01Ah,004h,081h,0F1h,071h,081h,0F1h
db 071h,081h,0F1h,071h,081h,071h,081h,005h
db 01Fh,081h,0F1h,071h,081h,0F1h,071h,081h
db 0F1h,071h,081h,071h,081h,001h,01Fh,014h
db 081h,0F1h,071h,081h,0F1h,071h,081h,0F1h
db 071h,081h,071h,081h,001h,01Fh,014h,081h
db 0F1h,071h,081h,0F1h,071h,081h,0F1h,071h
db 081h,071h,081h,001h,01Fh,014h,081h,0F1h
db 071h,081h,0F1h,071h,081h,0F1h,071h,081h
db 071h,081h,001h,01Fh,014h,081h,0F1h,071h
db 081h,0F1h,071h,081h,0F1h,071h,081h,071h
db 081h,001h,01Fh,014h,081h,0F1h,071h,081h
db 0F1h,071h,081h,0F1h,071h,081h,071h,081h
db 001h,01Fh,014h,081h,0F1h,071h,081h,0F1h
db 071h,081h,0F1h,071h,081h,071h,081h,001h
db 01Fh,014h,081h,0F1h,071h,081h,0F1h,071h
db 081h,0F1h,071h,081h,071h,081h,001h,01Fh
db 014h,081h,0F1h,071h,081h,0F1h,071h,081h
db 0F1h,071h,081h,071h,081h,001h,01Fh,014h
db 081h,0F1h,071h,081h,0F1h,071h,081h,0F1h
db 071h,081h,071h,081h,001h,01Fh,014h,081h
db 0F1h,071h,081h,0F1h,071h,081h,0F1h,071h
db 081h,071h,081h,001h,01Fh,014h,081h,0F1h
db 071h,081h,0F1h,071h,081h,0F1h,071h,081h
db 071h,081h,001h,01Fh,014h,081h,0F1h,071h
db 081h,0F1h,071h,081h,0F1h,071h,081h,071h
db 081h,001h,01Fh,014h,081h,0F1h,071h,081h
db 0F1h,071h,081h,0F1h,071h,081h,071h,081h
db 001h,01Fh,014h,081h,0F1h,071h,081h,0F1h
db 071h,081h,0F1h,071h,081h,071h,081h,001h
db 01Fh,014h,081h,0F1h,071h,081h,0F1h,071h
db 081h,0F1h,071h,081h,071h,081h,001h,01Fh
db 012h,08Fh,081h,001h,01Eh,081h,0F3h,07Eh
db 001h,01Ch,08Fh,084h,002h,01Ah,081h,0F2h
db 07Fh,073h,081h,001h,019h,00Fh,008h,000h
 
newspaper db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,013h
db 003h,01Fh,01Dh,001h,0F3h,002h,01Fh,01Ah
db 001h,0F2h,001h,0F3h,002h,01Fh,017h,001h
db 0F2h,002h,0F1h,001h,0F3h,002h,01Fh,014h
db 001h,0F2h,001h,0F1h,002h,0F2h,001h,081h
db 0F2h,002h,01Fh,011h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,0F1h,081h,001h,0F3h,002h
db 01Dh,001h,0F1h,071h,0F3h,001h,0F2h,001h
db 071h,001h,0F2h,001h,0F4h,002h,01Ah,001h
db 0F2h,081h,001h,081h,0F3h,001h,081h,0F3h
db 001h,0F1h,081h,0F1h,081h,0F3h,002h,017h
db 001h,0F1h,071h,0F3h,081h,001h,071h,0F2h
db 071h,001h,0F1h,001h,0F1h,082h,0F1h,001h
db 0F1h,001h,081h,0F2h,002h,014h,001h,0F2h
db 081h,001h,081h,0F3h,071h,001h,081h,0F3h
db 003h,0F1h,001h,0F1h,001h,0F1h,081h,001h
db 0F3h,001h,012h,001h,0F1h,071h,0F3h,081h
db 001h,071h,0F3h,081h,001h,081h,0F3h,002h
db 0F3h,001h,0F4h,001h,071h,011h,001h,0F2h
db 081h,001h,081h,0F3h,071h,001h,081h,0F3h
db 071h,0F1h,001h,0F3h,001h,081h,0F1h,001h
db 0F3h,001h,071h,002h,081h,071h,0F3h,081h
db 001h,071h,0F3h,081h,001h,081h,0F2h,001h
db 0F1h,002h,0F2h,081h,001h,0F3h,001h,071h
db 001h,071h,001h,0F1h,081h,001h,081h,0F3h
db 071h,001h,081h,0F3h,071h,0F1h,001h,071h
db 0F3h,002h,0F4h,001h,071h,001h,071h,002h
db 0F3h,081h,001h,071h,0F3h,081h,001h,081h
db 0F2h,001h,074h,0F3h,001h,0F2h,001h,071h
db 001h,071h,001h,071h,001h,071h,001h,081h
db 0F2h,071h,001h,081h,0F3h,071h,0F1h,001h
db 083h,074h,001h,0F2h,001h,071h,001h,071h
db 001h,071h,002h,081h,072h,001h,081h,0F2h
db 081h,001h,081h,0F3h,002h,084h,071h,001h
db 0F2h,001h,071h,001h,071h,001h,071h,001h
db 012h,002h,081h,073h,081h,0F2h,081h,072h
db 0F3h,002h,082h,001h,0F2h,001h,071h,001h
db 071h,001h,071h,001h,015h,002h,081h,072h
db 001h,081h,0F2h,071h,001h,081h,0F3h,002h
db 0F2h,001h,071h,001h,071h,001h,071h,001h
db 018h,002h,081h,072h,001h,081h,0F2h,081h
db 001h,081h,0F4h,001h,071h,001h,071h,001h
db 071h,001h,01Bh,002h,081h,071h,0F1h,071h
db 081h,0F2h,081h,001h,0F2h,001h,071h,001h
db 071h,001h,071h,001h,01Eh,002h,081h,071h
db 081h,001h,081h,0F3h,001h,071h,001h,071h
db 001h,071h,001h,01Fh,012h,002h,081h,072h
db 001h,0F1h,001h,071h,001h,071h,001h,071h
db 001h,01Fh,015h,002h,081h,072h,001h,071h
db 002h,071h,001h,01Fh,018h,002h,081h,001h
db 081h,072h,001h,01Fh,01Bh,005h,000h
 
umbrella db 1
db 01Fh,01Fh,01Fh,036h,01Fh,018h,033h,0F6h
db 032h,01Fh,014h,032h,0F3h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,032h,015h,082h
db 019h,031h,0F2h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B3h,032h,0B2h,032h,012h,081h,001h
db 081h,018h,038h,0F1h,0B2h,032h,0B6h,032h
db 001h,01Ah,03Bh,0B7h,031h,0B1h,071h,001h
db 01Ah,03Dh,0B4h,031h,0B3h,071h,001h,019h
db 03Eh,0B2h,031h,0B4h,071h,001h,019h,034h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,035h
db 0B6h,071h,001h,018h,032h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,031h,001h,0B6h,071h,001h,019h,031h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,001h,081h,001h,031h,0B6h
db 031h,001h,018h,031h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,001h,081h
db 001h,0B1h,032h,0B4h,031h,071h,001h,019h
db 031h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,001h,081h,001h,0B1h,071h,0B1h,032h
db 0B2h,031h,0B2h,071h,001h,018h,031h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,001h,081h
db 001h,0B1h,071h,0B1h,071h,034h,0B3h,071h
db 001h,019h,031h,0B1h,071h,0B1h,071h,0B1h
db 001h,081h,001h,0B1h,071h,0B1h,071h,0B1h
db 033h,0B4h,071h,001h,01Ah,031h,0B1h,071h
db 0B1h,001h,081h,001h,0B1h,071h,0B1h,071h
db 0B1h,071h,034h,0B3h,071h,001h,01Bh,031h
db 0B1h,001h,081h,001h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,034h,0B3h,071h,001h,01Ch
db 001h,081h,001h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,035h,0B2h,071h,001h,01Bh
db 081h,071h,001h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,035h,0B2h,071h,001h
db 01Ah,081h,071h,001h,011h,001h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,035h,0B1h
db 071h,001h,01Ah,081h,071h,001h,013h,001h
db 0B1h,071h,0B1h,071h,0B1h,071h,037h,071h
db 001h,019h,081h,071h,001h,015h,002h,071h
db 0B1h,071h,038h,001h,019h,081h,071h,001h
db 018h,002h,038h,001h,015h,082h,012h,081h
db 071h,001h,01Bh,008h,015h,081h,071h,001h
db 011h,081h,071h,001h,01Fh,019h,081h,071h
db 001h,011h,081h,071h,001h,01Fh,01Ah,001h
db 071h,011h,081h,071h,001h,01Fh,01Bh,002h
db 081h,071h,001h,01Fh,01Dh,003h,000h
 
books db 0
db 00Fh,00Fh,006h,061h,021h,003h,022h,00Fh
db 009h,061h,0A1h,024h,0A1h,021h,00Eh,052h
db 003h,052h,002h,061h,0A1h,021h,071h,0F1h
db 071h,0A1h,022h,00Dh,051h,0D1h,054h,0D1h
db 051h,001h,061h,0A1h,021h,071h,0F1h,071h
db 0A1h,023h,012h,003h,012h,005h,051h,0D1h
db 051h,071h,0F1h,071h,0D1h,052h,061h,022h
db 071h,0F1h,071h,024h,011h,091h,014h,091h
db 011h,004h,051h,0D1h,051h,071h,0F1h,071h
db 0D1h,053h,061h,0A1h,027h,011h,091h,011h
db 071h,0F1h,071h,091h,012h,042h,001h,041h
db 052h,071h,0F1h,071h,055h,061h,0A1h,063h
db 023h,011h,091h,011h,071h,0F1h,071h,091h
db 011h,091h,041h,071h,043h,0D1h,059h,061h
db 0A1h,062h,023h,013h,071h,0F1h,071h,012h
db 091h,041h,071h,041h,071h,0F1h,041h,0D1h
db 059h,061h,0A1h,034h,021h,011h,081h,014h
db 091h,011h,041h,071h,041h,071h,0F1h,071h
db 041h,0D1h,059h,061h,0A1h,062h,023h,011h
db 081h,095h,011h,042h,071h,0F1h,071h,042h
db 0D1h,059h,061h,0A1h,063h,022h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 034h,021h,011h,081h,034h,091h,011h,071h
db 046h,0D1h,059h,061h,0A1h,063h,022h,011h
db 081h,095h,011h,071h,046h,0D1h,059h,061h
db 0A1h,062h,023h,011h,081h,095h,011h,071h
db 0C4h,042h,0D1h,059h,061h,0A1h,063h,022h
db 011h,081h,034h,091h,011h,071h,046h,0D1h
db 059h,061h,0A1h,062h,023h,011h,081h,095h
db 011h,071h,0C4h,042h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,062h,023h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,062h,023h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,062h,023h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,034h,021h,011h,081h
db 034h,091h,011h,071h,046h,0D1h,059h,061h
db 0A1h,063h,022h,011h,081h,095h,011h,071h
db 0C4h,042h,0D1h,059h,061h,0A1h,062h,023h
db 011h,081h,095h,011h,071h,046h,0D1h,059h
db 061h,0A1h,034h,021h,011h,081h,034h,091h
db 011h,071h,0C4h,042h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,058h,001h,061h,0A1h,062h,023h,011h
db 081h,095h,011h,071h,046h,0D1h,057h,003h
db 026h,001h,016h,001h,046h,001h,056h,000h
 
paint db 6
db 06Fh,06Fh,069h,008h,06Fh,067h,002h,071h
db 0F6h,071h,002h,06Fh,064h,001h,0F3h,071h
db 0B1h,071h,0B1h,071h,0B1h,072h,031h,001h
db 06Fh,062h,001h,0F1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 031h,001h,06Bh,001h,063h,001h,0F1h,071h
db 0B1h,071h,0B1h,0D6h,071h,0B1h,071h,0B1h
db 031h,001h,06Ah,002h,062h,001h,0F1h,0B1h
db 071h,0B1h,071h,0B1h,0D6h,051h,0B1h,071h
db 031h,001h,06Ah,002h,061h,001h,071h,0F1h
db 071h,0B1h,071h,0B1h,0D7h,051h,071h,0B1h
db 071h,031h,001h,068h,001h,0F1h,001h,061h
db 001h,0F1h,071h,0B1h,071h,0B1h,071h,0B1h
db 051h,0D6h,051h,071h,0B1h,031h,001h,067h
db 001h,0F1h,002h,061h,001h,0F1h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,052h,0D3h,052h
db 0B1h,071h,0B1h,031h,001h,066h,004h,061h
db 001h,0F1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,054h,0B1h,071h,0B1h,071h
db 031h,001h,065h,004h,061h,001h,0F1h,071h
db 0B1h,071h,0A1h,021h,0A1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,031h,001h,063h,001h,0F1h,001h
db 063h,001h,0F1h,0B1h,071h,0A1h,021h,0A1h
db 021h,0A1h,021h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,071h,031h
db 001h,061h,001h,0F1h,001h,064h,001h,0F1h
db 071h,0B1h,021h,0A1h,021h,0A1h,021h,0A1h
db 021h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,031h,001h,0F1h
db 001h,065h,001h,0F1h,0B1h,021h,0A1h,021h
db 0A1h,021h,0A1h,022h,071h,0B1h,071h,0B1h
db 071h,0B1h,072h,033h,071h,001h,0C1h,002h
db 065h,001h,0F1h,071h,022h,0A1h,021h,0A1h
db 022h,071h,0B1h,071h,0B1h,071h,0B1h,072h
db 031h,004h,0C1h,001h,082h,001h,064h,001h
db 0F1h,0B1h,071h,025h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,031h,001h,062h,001h
db 0C1h,002h,081h,071h,031h,001h,063h,001h
db 0F1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 031h,001h,061h,001h,0C1h,001h,061h,001h
db 073h,031h,001h,062h,001h,0F1h,0B1h,071h
db 0B1h,071h,0B1h,071h,093h,071h,0B1h,071h
db 0B1h,071h,0B1h,031h,002h,0C1h,001h,062h
db 001h,071h,0B1h,071h,031h,001h,062h,001h
db 0F1h,071h,0B1h,071h,0B1h,071h,094h,011h
db 071h,0B1h,071h,0B1h,071h,0B1h,031h,002h
db 062h,001h,071h,0B1h,071h,0B1h,071h,031h
db 001h,062h,001h,0B1h,071h,0B1h,071h,095h
db 011h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 031h,003h,071h,0B1h,071h,0B1h,071h,0B1h
db 031h,001h,062h,001h,071h,0B1h,071h,0B1h
db 096h,011h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,031h,001h,062h,001h,0B1h,071h
db 0B1h,071h,011h,096h,011h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,031h,001h,063h,001h
db 0B1h,071h,0B1h,071h,011h,093h,012h,0B1h
db 071h,0B1h,071h,0C3h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,031h,001h,063h
db 001h,0F1h,0B1h,071h,0B1h,071h,013h,071h
db 0B1h,071h,0B1h,0C6h,041h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,031h,001h,064h,001h
db 0F1h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,0C8h,041h,0B1h,071h,0B1h,071h
db 0B1h,032h,001h,065h,001h,0F1h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0C8h,041h
db 071h,0B1h,071h,0B1h,071h,031h,001h,067h
db 001h,0F1h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,041h,0C5h,042h,071h,0B1h,071h,0B1h
db 071h,032h,001h,068h,001h,081h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,045h,0B1h,071h
db 0B1h,071h,0B1h,071h,032h,001h,06Ah,002h
db 031h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,033h,002h
db 06Bh,005h,03Bh,003h,06Ch,002h,064h,00Bh
db 000h
 
molecule db 1
db 01Eh,084h,01Fh,01Bh,082h,064h,002h,01Fh
db 018h,081h,068h,001h,01Fh,017h,081h,061h
db 0F1h,071h,065h,001h,01Fh,013h,033h,082h
db 061h,072h,066h,001h,033h,01Ch,032h,093h
db 002h,062h,034h,063h,001h,093h,002h,019h
db 031h,097h,032h,094h,002h,061h,001h,094h
db 031h,001h,018h,031h,091h,0F1h,071h,093h
db 031h,097h,031h,001h,0F1h,071h,093h,031h
db 001h,017h,031h,092h,072h,093h,031h,091h
db 0F1h,071h,094h,031h,001h,072h,093h,032h
db 001h,016h,031h,096h,031h,092h,072h,094h
db 032h,001h,094h,032h,001h,016h,031h,096h
db 031h,097h,033h,001h,093h,033h,001h,017h
db 001h,095h,031h,097h,033h,001h,082h,091h
db 032h,001h,016h,082h,001h,093h,083h,001h
db 094h,034h,001h,063h,002h,031h,003h,013h
db 081h,063h,001h,082h,063h,001h,038h,001h
db 064h,081h,001h,063h,001h,012h,081h,061h
db 0F1h,071h,081h,066h,002h,034h,002h,065h
db 081h,001h,063h,001h,011h,081h,062h,072h
db 081h,061h,0F1h,071h,064h,081h,004h,021h
db 0F1h,071h,064h,082h,001h,062h,081h,001h
db 081h,063h,081h,062h,072h,064h,081h,034h
db 021h,072h,063h,083h,001h,062h,081h,001h
db 081h,063h,081h,067h,032h,094h,002h,064h
db 083h,001h,061h,082h,002h,063h,081h,066h
db 031h,097h,031h,001h,063h,083h,001h,061h
db 082h,001h,011h,001h,063h,001h,065h,031h
db 091h,0F1h,071h,094h,031h,001h,085h,001h
db 031h,082h,001h,012h,001h,082h,031h,001h
db 084h,031h,092h,072h,094h,032h,001h,084h
db 001h,031h,082h,001h,013h,001h,031h,091h
db 071h,002h,082h,031h,097h,033h,001h,082h
db 002h,091h,031h,002h,015h,031h,094h,002h
db 031h,097h,033h,003h,093h,031h,001h,016h
db 031h,097h,001h,094h,034h,001h,095h,032h
db 001h,016h,031h,097h,001h,038h,001h,095h
db 032h,001h,017h,001h,094h,033h,002h,034h
db 002h,094h,033h,001h,018h,001h,037h,001h
db 061h,004h,061h,001h,037h,001h,019h,002h
db 033h,002h,066h,082h,002h,033h,002h,01Ch
db 004h,067h,083h,004h,01Fh,013h,001h,088h
db 001h,01Fh,018h,002h,084h,002h,01Fh,01Bh
db 004h,000h
 
cd db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,014h
db 086h,01Fh,018h,083h,0B3h,073h,083h,01Fh
db 013h,083h,0E2h,0B3h,076h,002h,01Fh,081h
db 0A2h,0E3h,0B3h,078h,001h,01Dh,081h,0A4h
db 0E3h,0B2h,079h,001h,01Bh,081h,072h,0A3h
db 0E3h,0B2h,07Ah,001h,01Ah,081h,0E1h,072h
db 0A3h,0E2h,0B2h,07Ah,001h,019h,081h,0E3h
db 072h,0A2h,0E2h,0B2h,07Bh,001h,018h,081h
db 072h,0E2h,072h,0A2h,0E1h,0B2h,07Bh,001h
db 017h,081h,075h,0E1h,072h,0A2h,084h,07Ah
db 001h,016h,081h,076h,0E1h,072h,081h,005h
db 071h,0F1h,077h,001h,016h,081h,077h,0E1h
db 081h,001h,014h,001h,081h,078h,001h,016h
db 081h,078h,081h,001h,014h,001h,081h,078h
db 001h,016h,082h,071h,081h,071h,081h,071h
db 081h,071h,081h,001h,014h,001h,081h,078h
db 001h,016h,081h,071h,081h,071h,081h,071h
db 081h,071h,082h,001h,014h,001h,081h,078h
db 001h,016h,082h,071h,081h,071h,081h,071h
db 081h,0F1h,071h,081h,004h,081h,079h,001h
db 016h,081h,071h,081h,071h,081h,071h,081h
db 0F1h,071h,0F1h,071h,084h,0E1h,079h,001h
db 017h,081h,071h,081h,071h,081h,0F1h,071h
db 0F1h,074h,0B1h,071h,0E2h,077h,001h,018h
db 082h,071h,081h,0F1h,071h,0F1h,074h,0B2h
db 0A1h,071h,0E2h,076h,001h,019h,082h,0F1h
db 071h,0F1h,076h,0B1h,0A1h,071h,0E3h,074h
db 001h,01Ah,081h,0F1h,071h,0F1h,076h,0B2h
db 0A2h,071h,0E3h,073h,001h,01Bh,081h,0F1h
db 078h,0B1h,0A2h,071h,0E4h,071h,001h,01Dh
db 081h,077h,0B3h,0A2h,071h,0E3h,001h,01Fh
db 082h,076h,0B2h,0A2h,071h,081h,002h,01Fh
db 013h,082h,073h,0B3h,0A1h,003h,01Fh,017h
db 007h,000h
 
trumpet db 1
db 01Ch,03Dh,001h,01Fh,014h,031h,0F1h,0B2h
db 036h,071h,001h,01Fh,016h,031h,0F1h,0B1h
db 035h,071h,001h,01Fh,018h,031h,0F1h,0B1h
db 033h,071h,001h,01Fh,013h,034h,012h,031h
db 0F1h,0B1h,033h,071h,001h,01Fh,012h,031h
db 0B2h,072h,032h,011h,031h,0B1h,032h,071h
db 001h,01Fh,012h,031h,0B1h,071h,003h,071h
db 0B1h,032h,0B1h,032h,071h,001h,01Fh,011h
db 031h,0F1h,071h,001h,013h,001h,071h,081h
db 031h,0B1h,032h,071h,001h,01Fh,011h,031h
db 0F1h,001h,014h,031h,001h,0B1h,031h,0B1h
db 032h,071h,001h,01Fh,011h,031h,0B1h,001h
db 014h,031h,001h,0B1h,031h,0B1h,032h,071h
db 001h,01Fh,011h,031h,0F1h,001h,012h,031h
db 011h,031h,001h,0B1h,031h,0B1h,032h,071h
db 001h,01Fh,011h,031h,0B1h,001h,011h,034h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0F1h,001h,031h,0F1h,0B2h,081h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0B1h,001h,031h,0B1h,081h,071h
db 081h,001h,0B1h,031h,0F5h,032h,011h,031h
db 001h,01Bh,031h,071h,031h,0F1h,0B1h,081h
db 001h,0B1h,001h,0F2h,035h,002h,032h,001h
db 01Bh,031h,0B1h,032h,003h,0B1h,0F1h,032h
db 0B1h,032h,071h,001h,012h,001h,031h,001h
db 01Bh,031h,071h,031h,0B2h,031h,001h,0B1h
db 031h,0B1h,031h,0B1h,032h,071h,001h,013h
db 002h,01Bh,031h,071h,032h,003h,0B1h,001h
db 0B1h,031h,0B1h,032h,071h,001h,01Fh,011h
db 031h,071h,031h,0B2h,031h,001h,0B1h,001h
db 0B1h,031h,0B1h,032h,071h,001h,01Fh,011h
db 031h,071h,032h,003h,0B1h,001h,0B1h,031h
db 0B1h,032h,071h,001h,01Fh,011h,031h,071h
db 031h,0B2h,001h,0B1h,031h,001h,0B1h,031h
db 0B1h,032h,071h,001h,01Fh,011h,031h,071h
db 031h,0B1h,081h,001h,0B1h,081h,001h,0B1h
db 031h,0B1h,032h,071h,001h,01Fh,011h,031h
db 071h,031h,0B1h,081h,001h,0B1h,081h,001h
db 0B1h,031h,0B1h,032h,071h,001h,01Fh,011h
db 031h,071h,031h,0B1h,081h,001h,0B1h,031h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0B1h,031h,0B1h,081h,001h,032h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0F1h,031h,0B1h,001h,031h,001h
db 031h,001h,0B1h,031h,0B1h,032h,071h,001h
db 01Fh,011h,031h,0B1h,032h,0B1h,001h,031h
db 002h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 012h,031h,0B1h,001h,034h,001h,0B1h,031h
db 0B1h,031h,071h,001h,01Fh,013h,031h,071h
db 031h,004h,032h,0B1h,001h,031h,071h,001h
db 01Fh,014h,031h,071h,0B1h,001h,0B2h,003h
db 072h,001h,01Fh,016h,002h,036h,002h,01Fh
db 019h,006h,000h
 
liquid db 1
db 019h,08Dh,01Fh,084h,06Dh,084h,018h,083h
db 06Fh,066h,083h,014h,081h,071h,06Dh,071h
db 0F3h,071h,067h,071h,081h,013h,081h,071h
db 06Ch,071h,0F5h,071h,066h,071h,081h,013h
db 081h,071h,06Eh,073h,068h,071h,081h,014h
db 081h,073h,06Fh,064h,073h,001h,015h,081h
db 0F1h,062h,073h,06Dh,073h,062h,081h,001h
db 016h,061h,0F1h,064h,07Dh,064h,081h,001h
db 017h,061h,0F1h,06Fh,066h,081h,001h,017h
db 061h,0F1h,06Fh,066h,081h,001h,017h,061h
db 0F1h,061h,0F1h,073h,06Fh,061h,081h,001h
db 017h,061h,0F1h,061h,0F1h,071h,063h,0AAh
db 065h,081h,001h,017h,061h,0F1h,061h,0F1h
db 071h,0AFh,0A1h,062h,081h,001h,017h,061h
db 0F1h,0A1h,0F1h,071h,0AFh,0A3h,081h,001h
db 017h,061h,0F1h,0A1h,0F1h,073h,0ABh,0F1h
db 0A4h,081h,001h,017h,061h,0F1h,0A1h,0F1h
db 071h,0AEh,0F1h,0A3h,081h,001h,017h,061h
db 0F3h,071h,0A3h,0F3h,0A6h,0F2h,0A4h,081h
db 001h,017h,061h,0F1h,0A1h,0F1h,071h,0A6h
db 0F6h,0A5h,0F1h,081h,001h,017h,061h,0F1h
db 0A1h,0F1h,073h,0AEh,0F1h,0A1h,081h,001h
db 017h,061h,0F1h,0A1h,0F1h,071h,0A1h,0F2h
db 0AAh,0F3h,0A2h,081h,001h,017h,061h,0F1h
db 0A1h,0F1h,071h,0A3h,0FAh,0A5h,081h,001h
db 017h,061h,0F1h,0A1h,0F1h,071h,0A3h,08Ah
db 0A5h,081h,001h,017h,061h,0F1h,0A1h,0F1h
db 073h,081h,0A5h,071h,0F2h,071h,0A1h,083h
db 0A2h,081h,001h,017h,061h,0F1h,0A1h,0F1h
db 071h,0A8h,071h,0F2h,071h,0A4h,083h,001h
db 017h,061h,0F1h,0A1h,0F1h,071h,0A9h,0F1h
db 071h,0A7h,081h,001h,017h,061h,0F1h,0A1h
db 0F1h,071h,0A9h,0F1h,071h,0A7h,081h,001h
db 018h,001h,081h,0A2h,072h,0A7h,0F2h,071h
db 0A5h,081h,001h,019h,001h,081h,0AAh,071h
db 0F2h,071h,0A5h,081h,001h,01Ah,001h,083h
db 0A7h,071h,0F2h,071h,0A2h,083h,001h,01Ch
db 003h,088h,072h,083h,003h,01Fh,011h,00Dh
db 000h
 
telephone db 1
db 01Fh,01Fh,01Fh,01Fh,01Dh,006h,01Fh,019h
db 002h,0F1h,0B5h,003h,01Fh,015h,001h,0B3h
db 0F5h,0B3h,003h,01Fh,011h,001h,0B4h,032h
db 002h,0B1h,0F3h,0B3h,002h,01Dh,001h,0B4h
db 032h,001h,0F1h,0B1h,001h,0B3h,0F2h,0B3h
db 002h,01Bh,002h,0B2h,033h,001h,0B1h,071h
db 031h,001h,0B4h,0F2h,0B3h,002h,019h,001h
db 0B1h,002h,031h,003h,0B1h,071h,031h,001h
db 031h,0B2h,002h,031h,0F2h,0B3h,001h,018h
db 001h,0B2h,031h,001h,071h,0B3h,071h,031h
db 001h,032h,001h,0F1h,0B1h,001h,031h,0B1h
db 0F1h,0B3h,001h,018h,001h,031h,001h,071h
db 0B7h,003h,0B1h,071h,031h,001h,031h,0B1h
db 0F1h,0B3h,001h,018h,001h,071h,0B2h,0F2h
db 031h,0B5h,001h,0B1h,071h,031h,001h,031h
db 0B2h,0F1h,0B3h,001h,016h,001h,071h,0B3h
db 031h,001h,0F2h,031h,0B5h,071h,031h,001h
db 031h,0B2h,0F1h,0B3h,0F1h,001h,014h,001h
db 071h,0B2h,0F2h,031h,0B1h,031h,001h,0F2h
db 031h,0B5h,001h,031h,0B3h,0F3h,031h,001h
db 013h,001h,071h,0B3h,031h,001h,0F2h,031h
db 0B1h,031h,001h,0B5h,071h,001h,031h,0B3h
db 071h,033h,001h,012h,001h,071h,0B2h,0F2h
db 031h,0B1h,031h,001h,0F2h,031h,0B5h,071h
db 031h,001h,031h,0B3h,071h,033h,001h,011h
db 001h,071h,0B3h,031h,001h,0F2h,031h,0B1h
db 031h,001h,0B5h,071h,032h,002h,0B3h,071h
db 033h,002h,071h,0F2h,0B4h,031h,001h,0F2h
db 031h,0B5h,071h,033h,001h,032h,0B2h,071h
db 032h,003h,071h,0F4h,0B4h,031h,001h,0B5h
db 071h,034h,001h,031h,0B1h,032h,003h,031h
db 002h,071h,0B2h,0F4h,0B8h,071h,036h,001h
db 0B3h,071h,033h,002h,071h,0B4h,0F4h,0B5h
db 071h,037h,002h,0B2h,033h,001h,011h,001h
db 071h,0B6h,0F4h,0B2h,071h,039h,006h,012h
db 002h,072h,0B6h,0F3h,071h,03Bh,002h,017h
db 002h,072h,0B6h,0F1h,03Ah,002h,01Bh,002h
db 072h,0B5h,038h,002h,01Fh,002h,072h,0B3h
db 036h,002h,01Fh,014h,002h,072h,0B1h,034h
db 002h,01Fh,018h,002h,071h,032h,002h,01Fh
db 01Ch,003h,000h
 
smile db 1
db 01Ch,008h,01Fh,016h,003h,0B8h,003h,01Fh
db 011h,002h,0BEh,002h,01Dh,002h,0BFh,0B1h
db 002h,01Bh,001h,0BFh,0B5h,001h,019h,001h
db 0BFh,0B7h,001h,017h,001h,0BFh,0B9h,001h
db 015h,002h,0BFh,0B9h,002h,014h,001h,0B8h
db 002h,0B6h,002h,0B8h,001h,013h,001h,0B8h
db 004h,0B4h,004h,0B8h,001h,012h,001h,0B8h
db 004h,0B4h,004h,0B8h,001h,012h,001h,0B8h
db 004h,0B4h,004h,0B8h,001h,011h,001h,0B9h
db 004h,0B4h,004h,0B9h,002h,0B9h,004h,0B4h
db 004h,0B9h,002h,0BAh,002h,0B6h,002h,0BAh
db 002h,0B7h,001h,0BEh,001h,0B7h,002h,0B7h
db 001h,0BEh,001h,0B7h,002h,0B6h,001h,0BFh
db 0B1h,001h,0B6h,002h,0B3h,004h,0BFh,0B1h
db 004h,0B3h,002h,0B7h,001h,0BEh,001h,0B7h
db 001h,011h,001h,0B7h,001h,0BCh,001h,0B7h
db 001h,012h,001h,0B7h,002h,0BAh,002h,0B7h
db 001h,012h,001h,0B8h,003h,0B6h,003h,0B8h
db 001h,013h,001h,0B8h,001h,091h,006h,091h
db 001h,0B8h,001h,014h,002h,0B8h,001h,096h
db 001h,0B8h,002h,015h,001h,0B9h,001h,094h
db 001h,0B9h,001h,017h,001h,0B9h,004h,0B9h
db 001h,019h,001h,0BFh,0B5h,001h,01Bh,002h
db 0BFh,0B1h,002h,01Dh,002h,0BEh,002h,01Fh
db 011h,003h,0B8h,003h,01Fh,016h,008h,000h
 
banana db 1
db 01Fh,01Fh,01Fh,01Fh,01Ah,002h,01Fh,01Eh
db 003h,01Fh,01Eh,003h,01Fh,01Eh,003h,01Fh
db 01Eh,003h,01Fh,01Dh,005h,01Fh,01Ch,001h
db 0B1h,001h,0B1h,001h,01Fh,01Bh,002h,0B1h
db 001h,0B2h,001h,01Fh,01Ah,001h,0B2h,001h
db 0B2h,001h,01Fh,01Ah,001h,0B2h,001h,0B3h
db 001h,01Fh,019h,001h,0B3h,001h,0B2h,001h
db 01Fh,019h,001h,0B3h,001h,0B3h,001h,01Fh
db 018h,001h,0B4h,001h,0B3h,001h,01Fh,017h
db 001h,0B4h,001h,0B4h,001h,01Fh,017h,001h
db 0B4h,001h,0B4h,001h,01Fh,016h,001h,0B5h
db 001h,0B4h,001h,01Fh,016h,001h,0B5h,001h
db 0B4h,002h,01Fh,015h,001h,0B5h,001h,0B5h
db 001h,01Fh,014h,001h,0B6h,001h,0B5h,002h
db 01Fh,013h,001h,0B6h,001h,0B6h,002h,01Fh
db 012h,001h,0B6h,002h,0B6h,002h,01Fh,011h
db 001h,0B7h,002h,0B6h,002h,01Fh,002h,0B7h
db 003h,0B5h,002h,01Fh,001h,0B9h,008h,01Fh
db 002h,0BCh,002h,01Fh,013h,004h,0B6h,003h
db 01Fh,018h,006h,000h
 
bolt db 1
db 01Fh,01Fh,01Fh,006h,01Fh,01Ah,001h,085h
db 002h,01Fh,018h,001h,078h,001h,01Fh,017h
db 081h,002h,071h,004h,081h,001h,01Fh,017h
db 001h,083h,073h,002h,081h,01Fh,017h,081h
db 001h,072h,085h,001h,01Fh,016h,002h,083h
db 073h,002h,081h,001h,01Fh,013h,002h,071h
db 081h,001h,072h,085h,001h,071h,002h,01Eh
db 002h,073h,001h,083h,073h,002h,081h,073h
db 002h,01Bh,001h,075h,081h,001h,087h,001h
db 075h,001h,01Ah,001h,0F2h,074h,081h,006h
db 081h,074h,003h,01Ah,001h,072h,0F2h,07Ch
db 002h,082h,001h,01Ah,001h,074h,0FBh,001h
db 084h,001h,01Ah,001h,075h,0F1h,078h,001h
db 085h,001h,01Ah,001h,075h,0F1h,078h,001h
db 085h,001h,01Bh,002h,073h,0F1h,078h,001h
db 083h,002h,01Eh,002h,071h,0F1h,078h,001h
db 081h,002h,01Fh,013h,00Ch,01Fh,016h,081h
db 001h,072h,085h,001h,01Fh,016h,002h,083h
db 073h,002h,081h,001h,01Fh,013h,002h,071h
db 081h,001h,072h,085h,001h,071h,002h,01Eh
db 002h,073h,001h,083h,073h,002h,081h,073h
db 002h,01Bh,001h,075h,081h,001h,072h,085h
db 001h,075h,001h,01Ah,001h,0F2h,074h,081h
db 006h,081h,074h,003h,01Ah,001h,072h,0F2h
db 07Ch,002h,082h,001h,01Ah,001h,074h,0FBh
db 001h,084h,001h,01Ah,001h,075h,0F1h,078h
db 001h,085h,001h,01Ah,001h,075h,0F1h,078h
db 001h,085h,001h,01Bh,002h,073h,0F1h,078h
db 001h,083h,002h,01Eh,002h,071h,0F1h,078h
db 001h,081h,002h,01Fh,013h,00Ch,000h
 
 
coltbl dd 000000h,800000h,008000h,808000h
dd 000080h,800080h,008080h,0C0C0C0h
dd 808080h,0FF0000h,00FF00h,0FFFF00h
dd 0000FFh,0FF00FFh,00FFFFh,0FFFFFFh
dd 0006688ddh ; bitton color
 
 
pict dd globe
dd wa
dd sword
dd cow
dd mace
dd cube
dd ball
dd dish
dd apple
dd ok
dd speaker
dd print
dd light
dd key1
dd foto
dd flop
dd pillar
dd newspaper
dd umbrella
dd books
dd flag
dd paint
dd molecule
dd cd
dd trumpet
dd liquid
dd telephone
dd smile
dd banana
dd bolt
 
labnew db 'New game Clicks:'
labnewlen:
 
 
nkeydown dd ?
bitstat db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
bitpict db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
firstbit db ?
secondbit db ?
 
 
bitid db ?
 
 
mas: ; mas db (32*32)*3+1 dup (?)
 
I_END=mas+(32*32)*3+1
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/md5/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm md5.asm md5
@pause
/programs/md5/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm md5.asm md5
@pause
/programs/md5/trunk/md5.asm
0,0 → 1,445
; à¨¬¥à ॠ«¨§ æ¨¨ £¥­¥à â®à  MD5 - å¥è 
;
; MD5 Generator
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
; ˆ¤¥ï, ॠ«¨§ æ¨ï ¨ ®â« ¤ª .
;
; €¢â®à: Halyavin
; ‘ ©â: www.shade.msu.ru/~msu-se/home.html
; „®à ¡®âª , ®â« ¤ª  ¨ ®¯â¨¬¨§ æ¨ï.
;
; Š®¬¯¨«¨àã¥âìáï Fasm'®¬ ¤«ï Œ¥­ãí⎑
include 'lang.inc'
macro diff16 title,l2
{
local s,d,l1
s = l2
display title,': 0x'
repeat 8
d = 48 + s shr ((8-%) shl 2) and $0F
if d > 57
d = d + 65-57-1
end if
display d
end repeat
display 13,10
}
 
use32
 
org 0x0
 
db 'MENUET01' ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
dd START ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
dd I_END ; à §¬¥à ¯à®£à ¬¬ë
dd 0x100000 ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
dd 0x100000 ;  ¤à¥á ¢¥à設ë áâíª 
dd 0x0 ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
 
START: ;  ç «® ¢ë¯®«­¥­¨ï ¯à®£à ¬¬ë
 
call draw_window ; ‘¯¥à¢  ¯¥à¥à¨á㥬 ®ª­®
 
still:
 
mov eax,23 ; Ž¦¨¤ ¥¬ ᮡë⨩
mov ebx,1
int 0x40
 
cmp eax,1 ; ‡ ¯à®á ­  ¯¥à¥à¨á®¢ªã ?
jz red
cmp eax,2 ; ­ ¦ â  ª« ¢¨è¨ ?
jz key
cmp eax,3 ; ­ ¦ â  ª­®¯ª  ?
jz button
 
jmp still
 
red:
call draw_window
jmp still
 
key:
mov eax,2
int 0x40
jmp still
 
button:
mov eax,17
int 0x40
 
cmp ah,1 ; id ª­®¯ª¨ = 1 ?
jnz noclose
mov eax,-1
int 0x40
 
noclose:
 
cmp ah,2 ; ƒ¥­¥à¨à®¢ âì?
je procMD5hash
 
jmp still
 
 
procMD5hash:
 
; phase I - padding
mov edi,ptBuffer
mov eax,[dtBufferLength]
 
inc eax
add edi,eax
mov byte [edi-1],0x80
 
xor edx,edx
 
mov ebx,64
div ebx
 
neg edx
add edx,64
 
cmp edx,8
jae @f
 
add edx,64
@@: mov ecx,edx
xor al,al
rep stosb
 
mov eax,[dtBufferLength]
 
inc edx
add [dtBufferLength],edx
 
xor edx,edx
 
mov ebx,8
mul ebx
 
mov [edi-8],eax
mov [edi-4],edx
 
mov edx,[dtBufferLength]
 
mov edi,ptBuffer
 
; phase II - chaining variables initialization
mov dword [dtA],067452301h
mov dword [dtB],0efcdab89h
mov dword [dtC],098badcfeh
mov dword [dtD],010325476h
mov esi,ptMD5Result
 
hashloop:
;diff16 "hashloop",hashloop
mov eax,[dtA]
mov [dta],eax
mov eax,[dtB]
mov [dtb],eax
mov eax,[dtC]
mov [dtc],eax
mov eax,[dtD]
mov [dtd],eax
macro ff dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
and ebx,eax
not eax
and eax,ecx
or eax,ebx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
macro gg dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
and eax,ecx
not ecx
and ecx,ebx
or eax,ecx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
macro hh dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
xor eax,ebx
xor eax,ecx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
macro ii dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
not ecx
or eax,ecx
xor eax,ebx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
; round 1
ff [dta],[dtb],[dtc],[dtd],dword [edi+00*4],07,0xd76aa478
ff [dtd],[dta],[dtb],[dtc],dword [edi+01*4],12,0xe8c7b756
ff [dtc],[dtd],[dta],[dtb],dword [edi+02*4],17,0x242070db
ff [dtb],[dtc],[dtd],[dta],dword [edi+03*4],22,0xc1bdceee
ff [dta],[dtb],[dtc],[dtd],dword [edi+04*4],07,0xf57c0faf
ff [dtd],[dta],[dtb],[dtc],dword [edi+05*4],12,0x4787c62a
ff [dtc],[dtd],[dta],[dtb],dword [edi+06*4],17,0xa8304613
ff [dtb],[dtc],[dtd],[dta],dword [edi+07*4],22,0xfd469501
ff [dta],[dtb],[dtc],[dtd],dword [edi+08*4],07,0x698098d8
ff [dtd],[dta],[dtb],[dtc],dword [edi+09*4],12,0x8b44f7af
ff [dtc],[dtd],[dta],[dtb],dword [edi+10*4],17,0xffff5bb1
ff [dtb],[dtc],[dtd],[dta],dword [edi+11*4],22,0x895cd7be
ff [dta],[dtb],[dtc],[dtd],dword [edi+12*4],07,0x6b901122
ff [dtd],[dta],[dtb],[dtc],dword [edi+13*4],12,0xfd987193
ff [dtc],[dtd],[dta],[dtb],dword [edi+14*4],17,0xa679438e
ff [dtb],[dtc],[dtd],[dta],dword [edi+15*4],22,0x49b40821
; round 2
gg [dta],[dtb],[dtc],[dtd],dword [edi+01*4],05,0xf61e2562
gg [dtd],[dta],[dtb],[dtc],dword [edi+06*4],09,0xc040b340
gg [dtc],[dtd],[dta],[dtb],dword [edi+11*4],14,0x265e5a51
gg [dtb],[dtc],[dtd],[dta],dword [edi+00*4],20,0xe9b6c7aa
gg [dta],[dtb],[dtc],[dtd],dword [edi+05*4],05,0xd62f105d
gg [dtd],[dta],[dtb],[dtc],dword [edi+10*4],09,0x02441453
gg [dtc],[dtd],[dta],[dtb],dword [edi+15*4],14,0xd8a1e681
gg [dtb],[dtc],[dtd],[dta],dword [edi+04*4],20,0xe7d3fbc8
gg [dta],[dtb],[dtc],[dtd],dword [edi+09*4],05,0x21e1cde6
gg [dtd],[dta],[dtb],[dtc],dword [edi+14*4],09,0xc33707d6
gg [dtc],[dtd],[dta],[dtb],dword [edi+03*4],14,0xf4d50d87
gg [dtb],[dtc],[dtd],[dta],dword [edi+08*4],20,0x455a14ed
gg [dta],[dtb],[dtc],[dtd],dword [edi+13*4],05,0xa9e3e905
gg [dtd],[dta],[dtb],[dtc],dword [edi+02*4],09,0xfcefa3f8
gg [dtc],[dtd],[dta],[dtb],dword [edi+07*4],14,0x676f02d9
gg [dtb],[dtc],[dtd],[dta],dword [edi+12*4],20,0x8d2a4c8a
; round 3
hh [dta],[dtb],[dtc],[dtd],dword [edi+05*4],04,0xfffa3942
hh [dtd],[dta],[dtb],[dtc],dword [edi+08*4],11,0x8771f681
hh [dtc],[dtd],[dta],[dtb],dword [edi+11*4],16,0x6d9d6122
hh [dtb],[dtc],[dtd],[dta],dword [edi+14*4],23,0xfde5380c
hh [dta],[dtb],[dtc],[dtd],dword [edi+01*4],04,0xa4beea44
hh [dtd],[dta],[dtb],[dtc],dword [edi+04*4],11,0x4bdecfa9
hh [dtc],[dtd],[dta],[dtb],dword [edi+07*4],16,0xf6bb4b60
hh [dtb],[dtc],[dtd],[dta],dword [edi+10*4],23,0xbebfbc70
hh [dta],[dtb],[dtc],[dtd],dword [edi+13*4],04,0x289b7ec6
hh [dtd],[dta],[dtb],[dtc],dword [edi+00*4],11,0xeaa127fa
hh [dtc],[dtd],[dta],[dtb],dword [edi+03*4],16,0xd4ef3085
hh [dtb],[dtc],[dtd],[dta],dword [edi+06*4],23,0x04881d05
hh [dta],[dtb],[dtc],[dtd],dword [edi+09*4],04,0xd9d4d039
hh [dtd],[dta],[dtb],[dtc],dword [edi+12*4],11,0xe6db99e5
hh [dtc],[dtd],[dta],[dtb],dword [edi+15*4],16,0x1fa27cf8
hh [dtb],[dtc],[dtd],[dta],dword [edi+02*4],23,0xc4ac5665
; round 4
ii [dta],[dtb],[dtc],[dtd],dword [edi+00*4],06,0xf4292244
ii [dtd],[dta],[dtb],[dtc],dword [edi+07*4],10,0x432aff97
ii [dtc],[dtd],[dta],[dtb],dword [edi+14*4],15,0xab9423a7
ii [dtb],[dtc],[dtd],[dta],dword [edi+05*4],21,0xfc93a039
ii [dta],[dtb],[dtc],[dtd],dword [edi+12*4],06,0x655b59c3
ii [dtd],[dta],[dtb],[dtc],dword [edi+03*4],10,0x8f0ccc92
ii [dtc],[dtd],[dta],[dtb],dword [edi+10*4],15,0xffeff47d
ii [dtb],[dtc],[dtd],[dta],dword [edi+01*4],21,0x85845dd1
ii [dta],[dtb],[dtc],[dtd],dword [edi+08*4],06,0x6fa87e4f
ii [dtd],[dta],[dtb],[dtc],dword [edi+15*4],10,0xfe2ce6e0
ii [dtc],[dtd],[dta],[dtb],dword [edi+06*4],15,0xa3014314
ii [dtb],[dtc],[dtd],[dta],dword [edi+13*4],21,0x4e0811a1
ii [dta],[dtb],[dtc],[dtd],dword [edi+04*4],06,0xf7537e82
ii [dtd],[dta],[dtb],[dtc],dword [edi+11*4],10,0xbd3af235
ii [dtc],[dtd],[dta],[dtb],dword [edi+02*4],15,0x2ad7d2bb
ii [dtb],[dtc],[dtd],[dta],dword [edi+09*4],21,0xeb86d391
mov eax,[dta]
add [dtA],eax
mov eax,[dtb]
add [dtB],eax
mov eax,[dtc]
add [dtC],eax
mov eax,[dtd]
add [dtD],eax
 
add edi,64
 
sub edx,64
jnz hashloop
 
; phase IV - results
 
mov ecx,4
mov esi,ptMD5Result
 
@@: mov eax,[esi]
xchg al,ah
rol eax,16
xchg al,ah
mov [esi],eax
 
add esi,4
loop @b
 
translate:
;diff16 "translate",translate
mov esi,ptMD5Result-5
mov edi,hexresult
mov ecx,16
@@:
test ecx,3
jnz .nojmp
add esi,8
.nojmp:
xor eax,eax
mov al,byte [esi]
mov edx,eax
shr eax,4
mov bl,byte [table+eax]
mov [edi],bl
inc edi
and edx,15
mov bl,byte [table+edx]
mov [edi],bl
dec esi
inc edi
loop @b
mov esi,hexresult
mov [text], esi
mov eax,32
mov [textlen], eax
call draw_window
 
jmp still
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
mov ecx,60*65536+100 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
; ¨á㥬 ª­®¯ªã ¤«ï £¥­¥à æ¨¨
mov eax,8 ; function 8 : define and draw button
mov ebx,20*65536+80 ; [x start] *65536 + [x size]
mov ecx,34*65536+14 ; [y start] *65536 + [y size]
mov edx,2 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
;  §¢ ­¨¥ ­  ª­®¯ªã
mov eax,4 ; function 4 : write text to window
mov ebx,23*65536+38 ; [x start] *65536 + [y start]
mov ecx,0x000000 ; color of text RRGGBB
mov edx,gen_txt ; pointer to text beginning
mov esi,gen_len-gen_txt ; text length
int 0x40
 
mov eax,4 ; draw info text with function 4
mov ebx,20*65536+70
mov ecx,0x000000
mov edx,[text]
xor eax,eax
mov al, [textlen]
mov esi,eax
mov eax,4
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
;Ž¡« áâì ¤ ­­ëå
 
labeltext: db 'MD5 Generator'
lte:
 
text: dd 0
textlen: dd 0
 
gen_txt: db '‘£¥­¥à¨à®¢ âì'
gen_len:
 
InputMD5Rez: dd 0
InputMD5Rezlen:
 
ptBuffer: db '123' ;‡ ¬¥­¨âì ­  £¥­¥à¨à㥬®¥ á«®¢®
rb 61
dtBufferLength: dd 3 ; §¬¥à ptBuffer
 
ptMD5Result:
 
dtA: dd 0
dtB: dd 0
dtC: dd 0
dtD: dd 0
 
dta: dd 0
dtb: dd 0
dtc: dd 0
dtd: dd 0
 
x: dd 0
s: dd 0
t: dd 0
 
table: db '0123456789abcdef'
hexresult db 32
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/menu/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm menu.asm menu
@pause
/programs/menu/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm menu.asm menu
@pause
/programs/menu/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/menu/trunk/menu.asm
0,0 → 1,581
;******************************************************************************
; MAIN MENU by lisovin@26.ru
; Some parts of code rewritten by Ivan Poddubny <ivan-yar@bk.ru>
;
; Compile with FASM for Menuet
;******************************************************************************
include "lang.inc"
include "macros.inc"
 
BTN_HEIGHT = 22
TXT_Y = (BTN_HEIGHT)/2-5
 
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 0x20000-1 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
;******************************************************************************
;include "DEBUG.INC" ; debug macros
START: ; start of execution
 
mov eax, 48 ; load system colors
mov ebx, 3
mov ecx, sc
mov edx, sizeof.system_colors
int 0x40
 
mov eax, 58 ; load MENU.DAT
mov ebx, fileinfo
int 0x40
test eax, eax ; error ?
jnz close
test ebx, ebx ; length = 0 ?
jz close
mov ecx, ebx
mov edi, mem_end
newsearch:
mov al, '#'
cld
repne scasb
test ecx, ecx ; if not found
jz close
call get_number
test ebx, ebx
jnz .number
cmp al, '#'
je search_end
.number:
shl ebx, 4
add ebx, menu_data ; pointer to process table
mov [ebx], edi
inc [processes]
jmp newsearch
search_end:
mov [end_pointer], edi
mov ebx, [processes]
dec ebx
shl ebx, 4
add ebx, menu_data
newprocess:
xor edx, edx
mov ecx, edi
sub ecx, [ebx]
mov al, 10
newsearch1:
std
repne scasb
test ecx, ecx
je endprocess
cmp [edi], byte 13
jne newsearch1
inc edx
jmp newsearch1
endprocess:
mov esi, ebx
add esi, 4
dec edx
mov [esi], dl
cmp ebx, menu_data
jbe search_end1
sub ebx, 16
jmp newprocess
search_end1:
mov eax, 14
int 0x40
sub ax, 20
mov [menu_data + y_end], ax
mov [menu_data + x_start], 5
mov al, [menu_data + rows]
mov [menu_data + cur_sel], al ; clear selection
mov [menu_data + prev_sel], al
 
mov [buffer], 0
thread:
mov eax, [buffer] ; identifier
shl eax, 4
add eax, menu_data
mov edi, eax
 
mov eax, 40 ; set event mask
mov ebx, 100111b ; mouse + button + key + redraw
int 0x40
 
call draw_window
 
still:
mov eax, 23 ; wait here for event
mov ebx, 5
int 0x40
 
test [close_now], 1 ; is close flag set?
jnz close
 
cmp eax, 1 ; redraw request ?
je red
cmp eax, 2 ; key pressed ?
je key
cmp eax, 3 ; button in buffer ?
je button
cmp eax, 6 ; mouse event ?
je mouse
 
cmp edi, menu_data
je still ; if main process-ignored
 
movzx ebx, [edi + parent] ; parent id
shl ebx, 4
add ebx, menu_data ; ebx = base of parent info
call backconvert ; get my id in al
cmp al, [ebx + child] ; if I'm not child of my parent, I shall die :)
jne close
 
jmp still
 
 
red: ; redraw
call draw_window
jmp still
 
 
key:
; mov eax, 2
int 0x40
 
mov al, [edi + rows] ; number of buttons
 
cmp ah, 178 ; KEY_UP
jne .noup
 
mov ah, [edi+cur_sel]
mov [edi+prev_sel], ah
dec byte [edi+cur_sel]
jnz redrawbut
mov [edi+cur_sel], al
jmp redrawbut
 
 
.noup:
cmp ah, 177 ; KEY_DOWN
jne .nodn
 
mov ah, [edi + cur_sel]
mov [edi + prev_sel], ah
inc [edi + cur_sel]
cmp [edi + cur_sel], al
jna redrawbut
mov [edi + cur_sel], 1
jmp redrawbut
 
.nodn:
cmp ah, 13 ; ENTER
jne .noenter
mov ah, [edi + cur_sel]
jmp button1
 
.noenter:
cmp ah, 27 ; ESC
jne still
jmp close
 
; include "DEBUG.INC"
 
button: ; BUTTON HANDLER
mov eax, 17 ; get id
int 0x40
 
button1:
mov esi, edi
push edi
mov edi, [edi + pointer]
 
; print "hello"
mov al, [esi + cur_sel]
mov [esi + prev_sel], al
mov [esi + cur_sel], ah
pushad
mov edi, esi
; dph eax
call draw_only_needed_buttons
popad
 
; look for the next line <ah> times; <ah> = button_id
push eax
.next_string:
call searchstartstring
dec ah
jnz .next_string
pop eax
 
mov ecx, 40
mov al, '/'
cld
repne scasb
test ecx, ecx ; if '/' not found
je searchexit
 
cmp [edi], byte '@' ; check for submenu
je runthread
 
dec edi
push edi ; pointer to start of filename
call searchstartstring ; search for next string
sub edi, 2 ; to last byte of string
 
mov ecx, edi
pop esi
sub ecx, esi
inc ecx ; length of filename
mov edi, fileinfo_start.name
rep movsb ; copy string
mov byte [edi], 0 ; store terminator
 
; mov eax,fileinfo_start.name
; cmp eax,'/rd/'
; jne run_hd
; mov ebx,fileinfo_start.name+6
; mov eax,19
; xor ecx,ecx
; jmp run_for_all
;run_hd:
mov eax, 58 ; start program
mov ebx, fileinfo_start
;run_for_all:
int 0x40
mcall 5,100
; mov eax,5
; mov ebx,100
; int 0x40
 
or [close_now], 1 ; set close flag
 
pop edi
mov [mousemask], 0
jmp close
 
searchexit:
pop edi
jmp still
 
 
runthread:
inc edi
 
push eax
call get_number ; get number of this process
pop eax
 
test ebx, ebx ; returned zero - main menu or not number
jz searchexit
 
mov al, bl
 
mov ebx, [processes]
dec bl
cmp al, bl
ja searchexit ; such process doesnt exist
cmp al, [esi + child]
je searchexit ; such process already exists
 
mov [esi + child], al ; this is my child
mov cx, [esi + x_start]
add cx, 141 ; new x_start in cx
movzx edx, al
shl edx, 4
add edx, menu_data ; edx points to child's base address
mov [edx + x_start], cx ; xstart for new thread
mov cx, [esi + y_end] ; y_end in cx
mov bl, [esi + rows] ; number of buttons in bl
sub bl, ah ; number of btn from bottom
movzx eax, al
mov [buffer], eax ; thread id in buffer
movzx ebx, bl
push edx
mov eax, BTN_HEIGHT
mul ebx
sub cx, ax ; new y_end for new thread
pop edx
mov [edx + y_end], cx ; store y_end
mov edi, esi
call backconvert ; get number of this process (al)
mov [edx + parent], al ; store number of parent process
mov al, [edx + rows]
mov [edx + cur_sel], al ; clear current selected element
mov [edx + prev_sel], al ; clear previous selected element
mov [edx + child], 0
 
cmp [thread_stack], 0x1e000
jne thread_stack_not_full
mov [thread_stack], 0xc000
 
thread_stack_not_full:
add [thread_stack], 0x2000 ; start new thread
mov eax, 51
mov ebx, 1
mov ecx, thread
mov edx, [thread_stack]
int 0x40
 
jmp searchexit
 
 
mouse: ; MOUSE EVENT HANDLER
mov eax, 37
mov ebx, 2
int 0x40
test eax, eax ; check buttons state
jnz click
mov eax, 37
mov ebx, 1
int 0x40
ror eax, 16 ; eax = [ Y | X ] relative to window
cmp ax, 140 ; pointer in window?
ja noinwindow
;  in window 
 
shr eax, 16 ; eax = [ 0 | Y ]
xor edx, edx
mov ebx, BTN_HEIGHT
div ebx
inc eax ; number of "button" in eax
movzx ebx, [edi + rows] ; total strings in ebx
cmp eax, ebx
ja noinwindow
cmp [edi + cur_sel], al
je noredrawbut
mov bl, [edi + cur_sel]
 
;;;;;;
cmp [edi + child], 0
jne noredrawbut
;;;;;;
 
mov [edi + cur_sel], al
mov [edi + prev_sel], bl
redrawbut:
call draw_only_needed_buttons
noredrawbut:
call backconvert
bts [mousemask], eax
jmp still
noinwindow:
call backconvert
btr [mousemask], eax
jmp still
click:
cmp [mousemask], 0 ; not in a window (i.e. menu)
je close
jmp still
 
 
close:
or eax, -1 ; close this thread
mov [edi + child], al ; my child is not mine
int 0x40
 
 
backconvert: ; convert from pointer to process id
mov eax, edi
sub eax, menu_data
shr eax, 4
ret
 
 
;==================================
; get_number
; load number from [edi] to ebx
;==================================
get_number:
push edi
 
xor eax, eax
xor ebx, ebx
 
.get_next_char:
mov al, [edi]
inc edi
cmp al, '0'
jb .finish
cmp al, '9'
ja .finish
sub al, '0'
imul ebx, 10
add ebx, eax
jmp .get_next_char
 
.finish:
pop edi
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
 
movzx ebx, [edi + rows]
imul eax, ebx, BTN_HEIGHT ; eax = height of window
movzx ecx, [edi + y_end]
sub ecx, eax ; ecx = Y_START
shl ecx, 16
add ecx, eax ; ecx = [ Y_START | Y_SIZE ]
dec ecx
movzx ebx, [edi + x_start]
shl ebx, 16
mov bx, 140 ; ebx = [ X_START | X_SIZE ]
xor eax, eax ; function 0 : define and draw window
mov edx, 0x01000000 ; color of work area RRGGBB,8->color gl
mov esi, edx ; unmovable window
int 0x40
 
call draw_all_buttons
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
 
draw_all_buttons:
xor edx, edx
.new_button:
call draw_one_button
inc edx
cmp dl, [edi + rows]
jb .new_button
 
ret
 
 
draw_only_needed_buttons:
xor edx, edx
mov dl, [edi + cur_sel]
dec dl
call draw_one_button
mov dl, [edi + prev_sel]
dec dl
call draw_one_button
ret
 
 
draw_one_button:
; receives number of button in dl
push edx;ad
 
mov eax, 8
mov ebx, 140
movzx ecx, dl
imul ecx, BTN_HEIGHT
shl ecx, 16
add ecx, BTN_HEIGHT-1
; edx = button identifier
mov esi, [sc.work_button]
inc dl
cmp [edi + cur_sel], dl
jne .nohighlight
add esi, 0x202020
.nohighlight:
or edx, 0x20000000
int 0x40
movzx edx, dl
 
dec dl
imul ebx, edx, BTN_HEIGHT
add ebx, (4 shl 16) + TXT_Y
 
movzx ecx, dl
inc ecx
mov edx, [edi + pointer]
.findline:
cmp byte [edx], 13
je .linefound
inc edx
jmp .findline
.linefound:
inc edx
cmp byte [edx], 10
jne .findline
dec ecx
jnz .findline
 
mov ecx, [sc.work_button_text]
mov eax, 4
mov esi, 21
int 0x40
 
pop edx;ad
ret
 
 
searchstartstring:
mov ecx, 40
mov al, 13
cld
repne scasb
cmp byte [edi], 10
jne searchstartstring
ret
 
 
;*** DATA AREA ****************************************************************
 
thread_stack dd 0xc000
processes dd 0
 
fileinfo:
.mode dd 0 ; 0=READ
.start_block dd 0x0 ; 512 block to read 0+
.size dd (0x10000-mem_end)/512 ;0x80; blocks to read (0x10000 bytes max)
.return dd mem_end ; return data pointer
.work dd workarea ; work area for os - 16384 bytes
.name:
db '/RD/1/MENU.DAT',0 ; ASCIIZ dir & filename
 
fileinfo_start:
.mode dd 16 ; 16=START APPLICATION
.start_block dd 0x0 ; nop
.size dd 0x0 ; nop
.return dd 0x0 ; nop
.work dd workarea ; work area for os - 16384 bytes
.name:
times 50 db ' '
 
I_END:
 
close_now dd ? ; close all processes immediately
end_pointer dd ?
buffer dd ?
mousemask dd ? ; mask for mouse pointer location
 
sc system_colors
 
menu_data:
rb 0x4000 ;x10000
 
workarea:
rb 0x4000 ;0x10000
 
virtual at 0 ; PROCESSES TABLE (located at menu_data)
pointer dd ? ; +0 pointer in file
rows db ? ; +4 numer of strings
x_start dw ? ; +5 x start
y_end dw ? ; +7 y end
child db ? ; +9 id of child menu
parent db ? ; +10 id of parent menu
cur_sel db ? ; +11 current selection
prev_sel db ? ; +12 previous selection
rb 16-$+1 ; [16 bytes per element]
end virtual
 
mem_end:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/menu/trunk/readme.txt
0,0 → 1,73
English text is below
ÍÎÂÎÅ ÃËÀÂÍÎÅ ÌÅÍÞ.
Âíèìàíèå: äëÿ êîððåêòíîé ðàáîòû ðåêîìåíäóåòñÿ MENUET íå íèæå 0.76
è öâåòíîé ìîíèòîð (íà ìîíîõðîìíîì ïîäñâåòêà íå âèäíà)
 
Îòëè÷èÿ îò Âèëëèíîãî ìåíþ:
1.Êîíôèãóðèðóåìîñòü. Ïóíêòû êàê îñíîâíîãî, òàê è äîïîëíèòåëüíûõ
ìåíþøåê çàäàþòñÿ ôàéëîì MENU.DAT.
Ýòî ïîçâîëÿåò:
-äîáàâëÿòü/óáèðàòü ëþáûå ïóíêòû â ìåíþ. Ïðîãðàììà ñàìà àíàëèçèðóåò
èçìåíåíèÿ è ðèñóåò îêíî ñ êíîïêàìè ïî êîëè÷åñòâó ïóíêòîâ. äàëüíåéøåì
èìõî ýòî ïîçâîëèò êîíôèãóðèðîâàòü ìåíþ íå òîëüêî âðó÷íóþ, íî è ïðîã-
ðàììíî. Íèêàêîãî âìåøàòåëüñòâà â êîä, ÷òî ïîçâîëÿåò êîíôèãóðèòü ìåíþ
è ïðîñòûì ïîëüçîâàòåëÿì.
-ïåðåâîäèòü ìåíþ íà ëþáûå ÿçûêè, íå ëàçÿ â êîä.
-ïîñêîëüêó çàïóñê ïðèëîæåíèé ÷åðåç 58-þ ôóíêöèþ, ïðèëîæåíèÿ ìîãóò íàõîäèòü-
ñÿ íå òîëüêî íà ðàìäèñêå.
2.Âåùèöà, ñîâñåì íå èíòåðåñíàÿ äëÿ ïîëüçîâàòåëåé, íî âîçìîæíî
ïðåäñòàâëÿþùàÿ èíòåðåñ äëÿ ïðîãðàììèñòîâ. Ïðèëîæåíèå ìíîãîïîòî÷íîå, íî âñå
ïîòîêè çàïóñêàþòñÿ íà îäíîì è òîì æå êîäå. Ýòî ïîçâîëèëî çàìåíèòü èñïîë-
íÿåìûå ôàéëû MENU, SELECT1, SELECT2 è ò.ä. îäíèì-åäèíñòâåííûì MENU
è ñèëüíî ñýêîíîìèòü ìåñòî íà äèñêå.
3.Ñàìîóíè÷òîæàåìîñòü ìåíþ ïðè êëèêå çà åãî ïðåäåëàìè è ïðè çàïóñêå ïðèëîæåíèÿ
4.Êíîïêè, ïîäñâå÷èâàåìûå ïðè íàâåäåíèè íà íèõ ìûøüþ (íà ìîíîõðîìíîì ìîíèòîðå
ïîäñâåòêà íå âèäíà).
5.Ïîääåðæêà êëàâèàòóðû. Êíîïêè Ââåðõ, Âíèç, Enter è Esc.
 îáùåì, ïîñòàðàëñÿ ïðèáëèçèòüñÿ ê âèíäîâñêîé ìåíþøêå.
 
Çàìå÷àíèÿ ïî ñèíòàêñèñó ôàéëà MENU.DAT:
Ðàçìåð ôàéëà MENU.DAT-íå áîëåå 2Ê
Ìåíþ #0-âñåãäà ãëàâíîå.
Êîëè÷åñòâî ìåíþ-íå áîëåå 10 - îò #0 äî #9
 êàæäîé ñòðîêå ëèáî ïóòü íà èñïîëíÿåìûé ôàéë, ëèáî ññûëêà íà äî÷åðíåå
ìåíþ, íàïðèìåð /@5
Ìàðêåð êîíöà ## îáÿçàòåëåí (âíèìàíèå! TINYPAD áûâàåò åãî îáðåçàåò)
Ïîä òåêñò íà ìåíþøíûõ êíîïêàõ îòâîäÿòñÿ ïåðâûå 20 ïîçèöèé êàæäîé ñòðîêè
Êàæäàÿ ñòðîêà îòäåëÿåòñÿ ENTERîì, ò.å. äîëæíû ïðèñóòñòâîâàòü çíàêè ïåðå-
âîäà ñòðîêè 0x0d,0x0a
 
Ïðîãà Î×ÅÍÜ ñûðàÿ, ïîýòîìó ïðîñüáà íå óäèâëÿòüñÿ, åñëè ÷òî-íèòü íå áóäåò
ðàáîòàòü. Ñ ôàéëîì MENU.DAT ïðîñüáà îáðàùàòüñÿ î÷åíü îñòîðîæíî. TINYPAD
èíîãäà åãî êàëå÷èò. Îñîáåííî ìàðêåð êîíöà ôàéëà!
Èñïîëíÿåìûé ôàéë î÷åíü ðåêîìåíäóåòñÿ íàçâàòü MENU. (ïðè êîìïèëÿöèè)
Òîãäà îí áóäåò âûçûâàòüñÿ èç ïàíåëè êàê è ïîëîæåíî.
Âñå çàìå÷àíèÿ è ïðåäëîæåíèÿ ñ óäîâîëüñòâèåì ïðèíèìàþòñÿ íà lisovin@26.ru
Ïðèàòòà÷åííûå ôàéëû ñëåäóåò âûñûëàòü íà mutny@rambler.ru
Ñ óâàæåíèåì,
Ìèõàèë Ëèñîâèí
 
NEW MAIN MENU
Requirements: MENUET 0.76, color monitor
WHAT'S NEW?
1.Self-configuring menu. All the configurational data is in MENU.DAT
You may add/remove menu positions, translate menu to any language,
run menu applications from HDD without source code change.
2.Multi-thread application. There're two files only: MENU and MENU.DAT
instead of MENU, SELECT1, SELECT2, SELECT3 etc.
3.Self-closing when running application or clicking out of menu.
4.Button highlight
5.Keyboard support (keys Up, Dn, Enter, Esc.)
So, it's just like Windows menu ;)
NOTES ON MENU.DAT:
Size of MENU.DAT should be not more than 2K
Number of menus-not more than 10 (from #0 to #9). #0 is always main menu
## is an end file marker - always required.
First 20 positions of any string reserved for button text
Any string contains file path or link to submenu, for example /@4.
You may edit MENU.DAT by any text editor, but be careful when using
TINYPAD (sometimes it cuts end marker).
It is recommended to compile MMENU.ASM as MENU. So, you can run it from
standard panel.
All the comments and bugreports send to lisovin@26.ru
Michail Lisovin.
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mfar.asm mfar
@pause
/programs/mfar/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mfar.asm mfar
@pause
/programs/mfar/trunk/macros.inc
0,0 → 1,226
; 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
}
 
 
 
 
 
; code profiling
macro STARTTIMER
{
push ecx
push ebx
rdtsc
push edx
push eax
}
 
macro STOPTIMER ;edx:eax = cpu cycles ellapsed
{
rdtsc
pop ebx
pop ecx
clc
sbb eax,ebx
sbb edx,ecx
pop ebx
pop ecx
}
 
 
; optimize the code for size
macro add arg1,arg2
{
if arg1 in <eax,ebx,ecx,edx,esi,edi,ebp,esp>
if arg2 eqtype 0
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
if 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
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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/menuet.inc
0,0 → 1,180
;------------------------------------------------------------------------------
;///// SYSTEM FUNCTIONS ///////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
MF_TERMINATE = -1
MF_DEFWINDOW = 0
WS_GRADIENT = $80000000
WS_NOSIZE = $00000000
WS_TRANSP = $01000000
WS_NORMAL = $02000000
WS_SKINNED = $03000000
MF_PUTPIXEL = 1
MF_GETKEY = 2
MF_GETTIME = 3
MF_DRAWTEXT = 4
DT_FIXED = $00000000
DT_VARIABLE = $10000000
MF_DELAY = 5
MF_RDREADFILE = 6
MF_PUTIMAGE = 7
MF_DEFBUTTON = 8
DB_ADD = $00000000
DB_DELETE = $80000000
BS_HIDDEN = $40000000
MF_PRINFO = 9
PI_SELF = $FFFFFFFF
MF_WAITEVENT = 10
MF_CHKEVENT = 11
MF_WNDDRAW = 12
WD_BEGINDRAW = 1
WD_ENDDRAW = 2
MF_FILLRECT = 13
FR_GRADIENT = $80000000
MF_GETSCRDIM = 14
MF_SETBKGND = 15
BG_SETSIZE = 1
BG_PUTPIXEL = 2
BG_REDRAW = 3
BG_SETSTYLE = 4
BGS_TILE = 1
BGS_STRETCH = 2
BG_SETIMAGE = 5
MF_RAM2FLOP = 16
R2F_ALL = 1
MF_GETPRSDBTNID = 17
MF_SYSSERV = 18
SYS_QUIT = 1
SYS_KILLPR = 2
SYS_SETFOCUS = 3
SYS_GETIDLE = 4
SYS_SETSPEED = 5
SYS_RAM2HARD = 6
MF_STARTPRG = 19
MF_MIDI = 20
MIDI_RESET = 1
MIDI_OUTPUT = 2
MF_DEVSETUP = 21
DEV_MIDI = 1
DEV_KEYB = 2
DEV_CD = 3
DEV_SB16 = 4
DEV_LANG = 5
DEV_WSS = 6
DEV_HD = 7
DEV_HDPART = 8
DEV_DMA = 10
DEV_LOWHDACC = 11
DEV_PCIACC = 12
DEV_VIDEODRV = 13
MF_WAITEVWTO = 23
MF_CDAUDIO = 24
CDA_PLAY = 1
CDA_GETPLIST = 2
CDA_STOP = 3
MF_SB16M1 = 25
SB_SETMAINVOL = 1
SB_SETCDVOL = 2
MF_GETDEVPREF = 26
DEV_GETTICKS = 9
MF_SOUNDPROPS = 27
MF_SB16M2 = 28
MF_GETDATE = 29
MF_HDREADFILE = 30
MF_HDSTARTPRG = 31
MF_RDDELFILE = 32
MF_RDWRITEFILE = 33
MF_RDREADDIR = 34
MF_GETPIXEL = 35
MF_MOUSEINFO = 37
MI_SCREENCRD = 0
MI_CLIENTCRD = 1
MI_BUTTONS = 2
MB_NONE = 0
MB_LEFT = 1
MB_RIGHT = 2
MB_BOTH = 3
MF_DRAWLINE = 38
MF_GETBKGND = 39
GB_SIZE = 1
GB_PIXEL = 2
GB_STYLE = 4
MF_SETEVMASK = 40
MF_GETIRQOWNER = 41
MF_GETIRQDATA = 42
MF_PORTIO = 43
MF_SETIRQTABLE = 44
MF_MANAGEIRQS = 45
IRQ_RESERVE = 0
IRQ_RELEASE = 1
MF_MANAGEPORTS = 46
PORT_RESERVE = 0
PORT_RELEASE = 1
MF_DRAWNUMBER = 47
DN_NUMBER = $00000000
DN_POINTER = $00000001
DN_DEC = $00000000
DN_HEX = $00000100
DN_BIN = $00000200
MF_WINPROPS = 48
WP_REDRAW = 0
WPR_DESKTOP = 0
WP_SETBTNSTYLE = 1
BS_FLAT = 0
BS_3D = 1
WP_SETSYSCLRS = 2
WP_GETSYSCLRS = 3
WP_GETSKINH = 4
MF_WINFREEFORM = 50
FF_SETSHAPE = 0
FF_SETSCALE = 1
MF_THREAD = 51
TH_CREATE = 1
MF_STACK = 52
MF_SOCKET = 53
MF_SOUND = 55
SND_LOADBLOCK = 0
SND_PLAYBLOCK = 1
SND_SETFORMAT = 2
SF_SETLENGTH = 1
MF_HDWRITEFILE = 56
MF_HDDELFILE = 57
MF_FSACCESS = 58
FS_READ = 0
FS_WRITE = 1
FS_DELETE = 2
FS_APPEND = 3
FS_LBAREAD = 8
FS_LBAWRITE = 9
FS_EXECUTE = 16
MF_SYSTRACE = 59
ST_GETEVENTS = 0
MF_IPC = 60
IPC_SETAREA = 1
IPC_SENDMSG = 2
MF_GRAPHPROPS = 61
GP_PERMIT = 1
GP_GETBPP = 2
GP_GETBPS = 3
MF_PCI = 62
MF_DEBUGBRD = 63
DBG_WRITE = 1
DBG_READ = 2
MF_MEMRESIZE = 64
MR_SETSIZE = 1
MF_UTF = 65
MF_KEYBMODE = 66
KM_SETMODE = 1
KM_GETMODE = 2
 
;------------------------------------------------------------------------------
;///// ERROR CODES ////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
ERR_SUCCESS = 0
 
ERR_FS_FIRST = 1
ERR_FS_LAST = 6
 
ERR_IRQ_NODATA = 1
ERR_IRQ_BADOWNER = 2
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/mf-copy.inc
0,0 → 1,204
;------------------------------------------------------------------------------
;///// COPYING ////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func copy_file
pushad
 
cmp [active_panel],0
jne ._00
push f_path0
push [f_plen0]
mov eax,[d_lpos]
shl eax,4
add eax,lstart
push eax
mov esi,f_path1
mov eax,[f_plen1]
jmp @f
._00:
push f_path1
push [f_plen1]
mov eax,[d_rpos]
shl eax,4
add eax,rstart
push eax
mov esi,f_path0
mov eax,[f_plen0]
@@:
mov ebx,[esp]
test byte[ebx+11],FA_FOLDER
jz @f
add esp,3*4
stc
jmp .close
@@:
mov edi,fc_info.path
call get_normal_path
mov eax,[len]
mov byte[edi+eax-1],'/'
mov [fc_len2],eax
 
pop esi
call get_file_info
mov eax,[f_size]
mov [fc_size],eax
 
pop eax
pop esi
mov edi,f_info.path
call get_normal_path
mov eax,[len]
mov byte[edi+eax-1],'/'
mov [fc_len1],eax
 
jmp .redraw_copy
 
.redraw:
call draw_window_full
.redraw_copy:
call draw_window_copy_main
.still:
mcall MF_WAITEVENT
jmpe al,.still,\
EV_REDRAW,.redraw,\
EV_KEY,.key,\
EV_BUTTON,.button
 
.key:
mcall MF_GETKEY
 
jmpe ah,.still,\
VK_ESCAPE,._close,\
VK_RETURN,.copy
 
.button:
jmp .still
 
.copy:
mov ecx,[fc_size]
shr ecx,9
inc ecx
push ecx
shl ecx,9
add ecx,MEM_USED
mcall MF_MEMRESIZE,MR_SETSIZE
or eax,eax
jnz .close
 
mov edi,file_info
mov al,' '
mov ecx,13
repne scasb
sub ecx,12
neg ecx
push ecx
mov esi,file_info
mov edi,f_info.path
add edi,[fc_len1]
rep movsb
mov byte[edi],0
pop ecx
mov esi,file_info
mov edi,fc_info.path
add edi,[fc_len2]
rep movsb
mov byte[edi],0
 
xor eax,eax ; FS_READ
mov [f_info],eax
mov [f_info+4],eax
pop eax
mov [f_info+8],eax
mov dword[f_info+12],MEM_USED
mcall MF_FSACCESS,f_info
mov eax,[fc_size]
mov [fc_info+8],eax
mcall MF_FSACCESS,fc_info
 
mcall MF_MEMRESIZE,MR_SETSIZE,MEM_USED
._close:
clc
.close:
popad
ret
endf
 
;------------------------------------------------------------------------------
 
func draw_window_copy_main
mcall2 MF_FILLRECT,oX+tW*2,tW*76,oY+tH*7,tH*8,0x00C0C0C0
 
mmov esi,oX+tW*4+2,oX+tW*75+3
mmov edi,oY+tH*8+3,oY+tH*13+5
xor edx,edx
call draw_frame
mmov esi,oX+tW*4+4,oX+tW*75+1
mmov edi,oY+tH*8+5,oY+tH*13+3
call draw_frame
 
mcall2 MF_DRAWLINE,oX+tW*4+4,oX+tW*75+1,oY+tH*11+3,oY+tH*11+3,0
 
mcall2 MF_FILLRECT,oX+tW*40-(sz_copy.size-2)*tW/2-tW,sz_copy.size*tW,\
oY+tH*8+3,3,0x00C0C0C0
mcall1 MF_DRAWTEXT,oX+tW*40-(sz_copy.size-2)*tW/2,oY+tH*8,\
0x00000000,sz_copy,sz_copy.size-2
 
mcall1 ,oX+tW*6,oY+tH*9,,,sz_copy.size
 
mov edi,file_info
mov al,' '
mov ecx,13
repne scasb
 
madd ebx,(sz_copy.size)*tW,0
mov esi,ecx
sub esi,12
neg esi
mcall MF_DRAWTEXT,,,file_info
imul esi,tW
shl esi,16
add ebx,esi
mcall ,,,sz_copyto,sz_copyto.size
 
call draw_copy_input
 
ret
endf
 
;------------------------------------------------------------------------------
 
func draw_copy_input
mcall2 MF_FILLRECT,oX+tW*6,tW*68,oY+tH*10,tH,0x00008080
 
mov edx,fc_info.path
mov esi,[fc_len2]
cmp esi,68
jb @f
sub esi,68
lea edx,[edx+esi+1]
mov esi,67
@@:
mcall1 MF_DRAWTEXT,oX+tW*6,oY+tH*10+1,0x00000000
ret
endf
 
;------------------------------------------------------------------------------
 
;fc_pst db 0
;fc_cur db 0
 
align 4
 
fc_size dd ?
fc_len1 dd 0
fc_len2 dd 0
 
fc_info:
dd 1
dd 0
dd ?
dd MEM_USED
dd MEM_FOR_OS
.path:
rb 200
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/mf-lang.inc
0,0 → 1,39
;------------------------------------------------------------------------------
;///// LOCALIZED STRINGS //////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
lsz lname,\
ru,'ˆ¬ï',\
en,'Name',\
fr,'Nom',\
ge,'Name'
lsz sort_kind,\
ru,'¨à',\
en,'nx',\
fr,'ne',\
ge,'ne'
lsz btmkeys,\
ru,'®¬®éì ®«ì§Œ à®á¬ ¥¤ ªâ Š®¯¨à ',\
ru,'¥à¥­  ¯ª  “¤ «¥­ Š®­äŒ­ ‚ë室',\
en,'Help UserMn View Edit Copy ',\
en,'RenMov MkFold Delete ConfMn Quit',\
fr,'Aide UserMn Vue Editer Copier ',\
fr,'RenDep CrÎeRp Efface ConfMn Quitter',\
ge,'Hilfe Menà Anzeig Bearb. Kopie ',\
ge,'UmbBew MkDir LÂsche Funkt. Ende'
lsz sz_cancel,\
ru,'Žâ¬¥­ ',\
en,'Cancel',\
fr,'Annuler',\
ge,'Beenden'
;---------- COPY DIALOG ----------
lsz sz_copy,\
ru,'Š®¯¨à®¢ âì "',\
en,'Copy "',\
fr,'Copier "',\
ge,'Kopiere "'
lsz sz_copyto,\
ru,'" ¢:',\
en,'" to:',\
fr,'" vers:',\
ge,'" nach:'
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/mf-sort.inc
0,0 → 1,140
;------------------------------------------------------------------------------
;///// SORTING ////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
r_sort db 1
l_sort db 1
 
align 4
compare_table:
dd compare_by_name
dd compare_by_extension
 
; AL = panel
func mfar_sort
pusha
cmp al,0
jne ._00
mov eax,[d_lcnt]
mov edi,lstart
movzx edx,[l_sort]
jmp @f
._00:
mov eax,[d_rcnt]
mov edi,rstart
movzx edx,[r_sort]
@@:
mov edx,[edx*4+compare_table]
cmp eax,2
jbe .exit
dec eax
shl eax,4
add eax,edi
cmp word[edi],'..'
jne @f
add edi,16
@@:
push edi
mov esi,edi
add edi,16
.next_file:
call edx
add edi,16
cmp edi,eax
jbe .next_file
 
mov ebx,12
@@:
mov ecx,[ebx+eax]
xchg [ebx+esi],ecx
mov [ebx+eax],ecx
sub ebx,4
jge @b
 
mov esi,[esp]
mov edi,esi
add edi,16
 
sub eax,16
cmp eax,edi
jge .next_file
pop edi
 
.exit:
popad
ret
endf
 
;------------------------------------------------------------------------------
 
; ESI = pointer to 1st file info
; EDI = pointer to 2nd file info
func compare_by_name
mov ecx,11
push edi esi
repe cmpsb
pop esi edi
pushfd
test byte[esi+11],FA_FOLDER
jnz ._00
test byte[edi+11],FA_FOLDER
jz ._01
jmp ._03
._00:
test byte[edi+11],FA_FOLDER
jz ._02
._01:
popfd
jg ._04
mov esi,edi
ret
._02:
popfd
mov esi,edi
ret
._03:
popfd
._04:
ret
endf
 
;------------------------------------------------------------------------------
 
; ESI = pointer to 1st file info
; EDI = pointer to 2nd file info
func compare_by_extension
push edi esi
mov ecx,3
add esi,8
add edi,8
repe cmpsb
jne ._00
mov esi,[esp]
mov edi,[esp+4]
mov ecx,8
repe cmpsb
._00:
pop esi edi
pushfd
test byte[esi+11],FA_FOLDER
jnz ._01
test byte[edi+11],FA_FOLDER
jz ._02
jmp ._04
._01:
test byte[edi+11],FA_FOLDER
jz ._03
._02:
popfd
jg ._05
mov esi,edi
ret
._03:
popfd
mov esi,edi
ret
._04:
popfd
._05:
ret
endf
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/mfar.asm
0,0 → 1,1181
 
; MENUET FAR [MFAR] PRE-ALPHA-8.1
; 2003-2004 (C) Mike Semenyako aka mike.dld
; Compile with FASM for Menuet
 
use32
org 0
 
db 'MENUET01' ; 8 byte id
dd $01 ; header version
dd START ; start of code
dd I_END ; size of image
dd MEM_USED ; memory for app
dd $007FF0 ; esp
dd $00,$00 ; I_Param , I_Icon
 
;
; START:SIZE
;
; +00000000:00007FF0 - image
; +00007FF0:00007FF0 - stack
; +00008000:00000300 - path strings buffer
; +00008300:0003FD00 - files data
; +00048000:00000300 - temporary file read area
; +00048300:00004000 - memory for OS (read/write buffer)
; +0004C300:FFFB3CFF - dinamically allocated for copy, view, edit etc.
;
 
include 'lang.inc'
include 'macros.inc'
include 'menuet.inc'
include 'mfar.inc'
 
START:
 
mcall MF_RDREADFILE,fcfile,0,-1,fc ; read user colors
 
mov esi,p_rd ; left panel = RD
mov edi,f_path0
mov ecx,p_rd.size
rep movsb
mov esi,p_hd ; right panel = HD
mov edi,f_path1
mov ecx,p_hd.size
rep movsb
 
redraw_all:
call draw_window_full
jmp still
redraw_files:
call draw_files
still:
mcall MF_WAITEVWTO,100 ; waiting 1 sec
jmpe al,,\
EV_REDRAW,redraw_all,\
EV_KEY,key,\
EV_BUTTON,button
 
; after every 1 second [when no other events occur] updating files info
; eg. requesting ACTIVE panel files data and drawing it
;; timed redraw {
mov dl,[active_panel]
cmp dl,0
jne ._00
push [d_ltsz]
jmp @f
._00:
push [d_rtsz]
@@:
call get_files_data
pop eax
cmp dl,0
jne ._01
cmp eax,[d_ltsz]
jmp @f
._01:
cmp eax,[d_rtsz]
@@:
je still ; nothing happened, waiting again
mov al,dl
jmp redraw_files
;; }
 
; key pressed event
key:
mcall MF_GETKEY ; get key-code
 
movzx ecx,[active_panel]
 
jmpe ah,k_directional,\
VK_RETURN,k_return,\ ; execute something
VK_TAB,k_tab,\ ; change active panel
VK_F5,k_f5,\ ; copy
VK_F10,mfar_exit,\ ; terminate
VK_CTRLF3,k_ctrl_f3,\ ; sort by name
VK_CTRLF4,k_ctrl_f4 ; sort by extension
;------------------------------------------------------------------------------
k_return:
call execute_current_file
jmp still
;------------------------------------------------------------------------------
k_tab:
mov edi,[fc.background]
call draw_sel ; hide current file selection
xor [active_panel],1 ; changing active panel
call draw_path ; drawing path of new panel
mov dl,[active_panel]
call get_files_data ; requesting panel files info
mov edi,sel_color
call draw_sel ; show current file
mov al,[active_panel]
call draw_file_info ; and its info (size,date)
jmp still
;------------------------------------------------------------------------------
k_f5:
call copy_file
jc still
jmp redraw_all
;------------------------------------------------------------------------------
k_ctrl_f3:
jecxz ._00
cmp [r_sort],0
je still
mov [r_sort],0
jmp @f
._00:
cmp [l_sort],0
je still
mov [l_sort],0
@@:
mov al,cl
call mfar_sort
jmp redraw_files
;------------------------------------------------------------------------------
k_ctrl_f4:
jecxz ._00
cmp [r_sort],1
je still
mov [r_sort],1
jmp @f
._00:
cmp [l_sort],1
je still
mov [l_sort],1
@@:
mov al,al
call mfar_sort
jmp redraw_files
;------------------------------------------------------------------------------
k_directional:
cmp ah,VK_LEFT ; non-directional keys ?
jb still ; ignore them
cmp ah,VK_END
ja still
jecxz ._00
mov edx,[d_rpos]
mov ebx,[d_rtop]
mov esi,[d_rcnt]
jmp @f
._00:
mov edx,[d_lpos]
mov ebx,[d_ltop]
mov esi,[d_lcnt]
@@:
xor ebp,ebp ; redraw whole panel [0-no, 1-yes]
;------------------------------------------------------------------------------
jmpe ah,show_cur,\
VK_LEFT,k_left,\
VK_DOWN,k_down,\
VK_UP,k_up,\
VK_RIGHT,k_right,\
VK_HOME,k_home,\
VK_END,k_end
k_left:
cmp edx,0
je still
sub edx,FPC
jge @f
xor edx,edx
@@:
mov eax,edx
sub eax,ebx
jge show_cur
inc ebp
sub ebx,FPC
jge show_cur
xor ebx,ebx
jmp show_cur
;------------------------------------------------------------------------------
k_down:
lea eax,[esi-1]
cmp edx,eax
je still
inc edx
mov eax,edx
sub eax,ebx
cmp eax,FPC*3-1
jle show_cur
inc ebp
inc ebx
jmp show_cur
;------------------------------------------------------------------------------
k_up:
cmp edx,0
je still
dec edx
mov eax,ebx
cmp edx,eax
jge show_cur
inc ebp
dec ebx
jmp show_cur
;------------------------------------------------------------------------------
k_right:
lea eax,[esi-1]
cmp edx,eax
je still
add edx,FPC
cmp edx,eax
jle @f
mov edx,eax
@@:
mov eax,edx
sub eax,ebx
cmp eax,FPC*3-1
jle show_cur
inc ebp
add ebx,FPC
jmp show_cur
;------------------------------------------------------------------------------
k_home:
cmp edx,0
je still
inc ebp
xor edx,edx
xor ebx,ebx
jmp show_cur
;------------------------------------------------------------------------------
k_end:
lea eax,[esi-1]
cmp edx,eax
je still
mov edx,eax
mov edi,eax
sub edi,ebx
cmp edi,FPC*3-1
jle show_cur
inc ebp
sub eax,FPC*3-1
mov ebx,eax
;------------------------------------------------------------------------------
 
show_cur:
 
mov edi,[fc.background]
call draw_sel
 
jecxz ._00
mov [d_rpos],edx
mov [d_rtop],ebx
jmp @f
._00:
mov [d_lpos],edx
mov [d_ltop],ebx
@@:
 
cmp ebp,0
mov al,cl
jne redraw_files
 
mov edi,[fc.selection]
call draw_sel
call draw_file_info
jmp still
 
button:
mcall MF_GETPRSDBTNID
cmp ah,1
jne noclose
 
mfar_exit:
mcall MF_RDDELFILE,fcfile ; delete existing mfar.dat
mcall MF_RDWRITEFILE,fcfile,fc,12*4,0 ; create new mfar.dat
 
mcall MF_TERMINATE ; close program
noclose:
jmp still
 
;------------------------------------------------------------------------------
;///// DRAW WINDOW ////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func draw_window
mcall MF_WINPROPS,WP_GETSYSCLRS,sc,sizeof.system_colors
 
mcall MF_WNDDRAW,WD_BEGINDRAW
mov edx,[fc.background]
or edx,WS_SKINNED
mcall2 MF_DEFWINDOW,90,oX+tW*80+4,45,oY+tH*25+4
mcall1 MF_DRAWTEXT,8,8,[sc.grab_text],caption,caption.size
 
mmov esi,oX+2,oX+tW*39+2
mmov edi,oY+3,oY+tH*22+3
mov edx,[fc.default]
call draw_frame
mmov esi,oX+tW*40+2,oX+tW*79+2
call draw_frame
 
mcall2 MF_DRAWLINE,oX+tW*13+2,oX+tW*13+2,oY+tH,oY+tH*20+3
madd ebx,tW*13,tW*13
mcall
mcall2 ,oX+3,oX+tW*39+1,oY+tH*20+3,oY+tH*20+3
mcall2 ,oX+tW*53+2,oX+tW*53+2,oY+tH,oY+tH*20+3
madd ebx,tW*13,tW*13
mcall
mcall2 ,oX+tW*40+3,oX+tW*79+1,oY+tH*20+3,oY+tH*20+3
 
mcall1 MF_DRAWTEXT,oX+tW*5,oY+tH,$00ffff00,lname,lname.size
mcall1 ,oX+tW*18,oY+tH
mcall1 ,oX+tW*31,oY+tH
mcall1 ,oX+tW*45,oY+tH
mcall1 ,oX+tW*58,oY+tH
mcall1 ,oX+tW*71,oY+tH
 
movzx edi,[l_sort]
lea edx,[edi+sort_kind]
mcall1 ,oX+tW,oY+tH,$00ffff00,,1
movzx edi,[r_sort]
lea edx,[edi+sort_kind]
mcall1 ,oX+tW*41,oY+tH
 
call draw_path
call draw_bottom_keys
 
mcall MF_WNDDRAW,WD_ENDDRAW
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func draw_window_full
call draw_window
mov edx,1
call get_files_data
mov al,1
call draw_files
mov edx,0
call get_files_data
mov al,0
call draw_files
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
align 4
len dd ?
 
func get_normal_path
pusha
mov ecx,5
rep movsb
dec esi
dec edi
mov ecx,5
push eax
@@:
dec dword[esp]
jz @f
lodsb
cmp al,0
je @b
cmp al,' '
je @b
stosb
inc ecx
jmp @b
@@:
pop eax
mov byte[edi],'>'
mov [len],ecx
popa
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; EAX = length needed
; ECX = current length
; EDI = path string
func get_path_ellipses
cmp ecx,eax
jbe @f
pushad
lea esi,[edi+ecx+3+6] ; ... + /??/?/
sub esi,eax
add ecx,edi
sub ecx,esi
mov dword[edi+6],'... '
add edi,9
cld
rep movsb
mov [len],eax
popad
@@:
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func draw_path
pushad
cmp [active_panel],0
jne ._00
mov esi,f_path0
mov eax,[f_plen0]
jmp @f
._00:
mov esi,f_path1
mov eax,[f_plen1]
@@:
mov edi,f_pathn
call get_normal_path
mov eax,39
mov ecx,[len]
mov edi,f_pathn
call get_path_ellipses
mcall2 MF_FILLRECT,oX-1,tW*80+1,oY+tH*23-1,tH,[fc.pathbg]
mcall1 MF_DRAWTEXT,oX,oY+tH*23,[fc.path],f_pathn,[len]
popad
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; AL = panel
func draw_files
push eax
mmov ecx,oY+tH*2-1,tH*FPC
mov edx,[fc.background]
cmp al,0
mov eax,MF_FILLRECT
jne ._00
mcall1 ,oX+tW-2,tW*12+3
mcall1 ,oX+tW*14-2,tW*12+3
mcall1 ,oX+tW*27-2,tW*12+3
mmov ebx,oX+tW,oY+tH*2
mov edx,[d_ltop]
shl edx,4
add edx,lstart
mov edi,[d_lcnt]
mov esi,edi
sub edi,[d_ltop]
jmp @f
._00:
mcall1 ,oX+tW*41-2,tW*12+3
mcall1 ,oX+tW*54-2,tW*12+3
mcall1 ,oX+tW*67-2,tW*12+3
mmov ebx,oX+tW*41,oY+tH*2
mov edx,[d_rtop]
shl edx,4
add edx,rstart
mov edi,[d_rcnt]
mov esi,edi
sub edi,[d_rtop]
@@:
cmp esi,0
je .exit_nok ; no files
 
mov ecx,3
.next_col:
push ecx
mov ecx,FPC
.next_row:
dec edi
jge @f
pop eax
jmp .exit_ok
@@:
push ecx
call get_file_color
mov esi,edx
call get_file_name
push edx
mcall 4,,,f_name,12 ; draw file name
pop edx ecx
add ebx,tH
 
add edx,16
dec ecx
jnz .next_row
pop ecx
dec ecx
jz .exit_ok
madd ebx,tW*13,0
mov bx,oY+tH*2
jmp .next_col
 
.exit_ok:
mov edi,sel_color
call draw_sel
.exit_nok:
pop eax
call draw_file_info
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func draw_bottom_keys
pushad
mcall2 MF_FILLRECT,oX-1,tW*80+1,oY+tH*24-1,tH+1,[fc.pathbg]
dec ecx
mcall1 ,oX+tW-1,tW*6+1,,[fc.keysbg]
mov esi,7
@@:
madd ebx,tW*8,0
mcall
dec esi
jge @b
mcall1 ,oX+tW*73-1,tW*7+1
mcall MF_DRAWNUMBER,$00010100,1,oX*65536+(oY+tH*24),[fc.path]
sub edx,$00010000
@@:
inc cl
madd edx,tW*8,0
mcall
cmp cl,10
jb @b
mcall1 MF_DRAWTEXT,oX+tW,oY+tH*24,[fc.keys],btmkeys,btmkeys.size
popad
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; ESI = X1*65536+X2
; EDI = Y1*65536+Y2
; EDX = color
func draw_frame
mov ecx,edi
mov ebx,edi
shr ebx,16
mov cx,bx
mcall MF_DRAWLINE,esi
mov ecx,edi
shl ecx,16
mov cx,di
mcall
mov ebx,esi
mov ecx,esi
shr ecx,16
mov bx,cx
mcall ,,edi
mov ebx,esi
shl ebx,16
mov bx,si
mcall
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; EDX = pointer to file data
func get_file_color
push esi
mov cl,[edx+11]
test cl,(FA_HIDDEN or FA_SYSTEM)
jz @f
mov ecx,[fc.system]
jmp .exit
@@:
test cl,FA_FOLDER
jz @f
mov ecx,[fc.folder]
jmp .exit
@@:
mov ecx,[edx+7]
and ecx,$ffffff00
or ecx,$00000020
 
mov esi,ext0-4
@@:
lodsd
or eax,eax
jz @f
cmp ecx,eax
jne @b
mov ecx,[fc.executable]
jmp .exit
@@:
lodsd
or eax,eax
jz @f
cmp ecx,eax
jne @b
mov ecx,[fc.bitmap]
jmp .exit
@@:
lodsd
or eax,eax
je @f
cmp ecx,eax
jne @b
mov ecx,[fc.source]
jmp .exit
@@:
mov ecx,[fc.default]
.exit:
pop esi
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; EDI = color
func draw_sel
pushad
cmp [active_panel],0
jne ._00
mov eax,[d_lpos]
sub eax,[d_ltop]
mov esi,[d_lcnt]
jmp @f
._00:
mov eax,[d_rpos]
sub eax,[d_rtop]
mov esi,[d_rcnt]
@@:
cmp esi,0
je .exit
mov cl,FPC
div cl
mov bp,ax
and eax,$000000FF
mov cl,tW*13
mul cl
add ax,oX+tW-2
push eax
shl eax,16
mov ax,tW*12+3
mov ebx,eax
mov ax,bp
shr eax,8
and eax,$000000FF
mov cl,tH
mul cl
add ax,oY+tH*2-1
push eax
shl eax,16
mov ax,tH
mov ecx,eax
mov edx,edi
cmp [active_panel],0
je @f
madd ebx,(40*6),0
@@:
mcall MF_FILLRECT
 
pop eax
movzx ebx,ax
inc bx
pop eax
add ax,2
shl eax,16
or ebx,eax
cmp [active_panel],0
jne ._01
mov edx,[d_lpos]
shl edx,4
add edx,lstart
jmp @f
._01:
mov edx,[d_rpos]
shl edx,4
add edx,rstart
@@:
mov esi,edx
call get_file_name
call get_file_color
cmp ecx,edi
jne @f
xor ecx,ecx
@@:
cmp [active_panel],0
je @f
madd ebx,tW*40,0
@@:
mcall MF_DRAWTEXT,,,f_name,12
.exit:
popad
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; AL = panel
func draw_file_info
push eax
mmov ecx,oY+tH*21,tH
mov edx,[fc.background]
cmp al,0
mov eax,MF_FILLRECT
jne ._00
mcall1 ,oX+tW,tW*38+1
mov esi,[d_lpos]
shl esi,4
add esi,lstart
mov edi,[d_lcnt]
jmp @f
._00:
mcall1 ,oX+tW*41,tW*38+1
mov esi,[d_rpos]
shl esi,4
add esi,rstart
mov edi,[d_rcnt]
@@:
cmp edi,0
jne @f
pop eax
ret
@@:
call get_file_info
mov dword[file_info+17],' '
mov word[file_info+15],' '
test byte[esi+11],FA_FOLDER
jz @f
mov dword[file_info+21],' DIR'
jmp .no_size
@@:
mov dword[file_info+21],' '
mov eax,[f_size]
mov esi,file_info+24
mov ebx,10
mov ecx,ebx
@@:
xor edx,edx
div ebx
add dl,'0'
mov [esi],dl
or eax,eax
jz .no_size
dec esi
loop @b
.no_size:
pop eax
mmov edx,oX+tW*35,oY+tH*21
mmov ebx,oX+tW,oY+tH*21
cmp al,0
je @f
madd edx,tW*40,0
madd ebx,tW*40,0
@@:
push edx
mcall MF_DRAWTEXT,,[fc.default],file_info,34
pop edx
mov esi,ecx
mov cx,[f_year]
mcall MF_DRAWNUMBER,$00040000
sub edx,$00240000 ; 6*6 = $24
movzx ecx,[f_day]
mcall ,$00020000
add edx,$00120000
mov cl,[f_mnth]
mcall
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func get_file_name
pushad
mov eax,[esi+0]
mov [f_name+0],eax
mov eax,[esi+4]
mov [f_name+4],eax
mov eax,[esi+8]
shl eax,8
and eax,$FFFFFF00
or al,$00000020
mov [f_name+8],eax
popad
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; ESI = pointer to file data
func get_file_info
pushad
mov eax,[esi+12]
mov dword[f_info],FS_READ
mov [f_info+4],eax
mov dword[f_info+12],read_area
mcall MF_FSACCESS,f_info
cmp eax,ERR_SUCCESS
je @f
cmp eax,ERR_FS_LAST
ja @f
popad
stc
ret
@@:
mov eax,read_area
mov ecx,16
.next_file:
mov edx,[esi+0]
cmp [eax+0],edx
jne @f
mov edx,[esi+4]
cmp [eax+4],edx
jne @f
mov edx,[esi+8]
cmp [eax+8],edx
jne @f
mov esi,eax
jmp .found
@@:
add eax,32
loop .next_file
.found:
push esi
mov eax,' '
mov ecx,3
mov edi,file_info
rep stosd
mov edi,file_info
mov ecx,2
rep movsd
mov edi,file_info
@@:
cmp byte[edi],' '
jbe @f
inc edi
jmp @b
@@:
mov eax,[esi]
shl eax,8
mov al,'.'
cmp eax,'. '
je @f
mov [edi],eax
@@:
pop esi
mov eax,[esi+28]
mov [f_size],eax
mov eax,[esi+24]
mov [f_day],al
and [f_day],00011111b
shr eax,5
mov [f_mnth],al
and [f_mnth],00001111b
shr eax,4
mov [f_year],ax
and [f_year],01111111b
add [f_year],1980
popad
clc
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
; DL = panel
func get_files_data
pushad
mov [d_tcnt],0
mov [d_ttsz],0
cmp dl,0
jne ._00
mov esi,f_path0
mov ecx,[f_plen0]
jmp @f
._00:
mov esi,f_path1
mov ecx,[f_plen1]
@@:
push edi
mov edi,f_info.path
mov byte[edi+ecx],0
rep movsb
pop edi
cmp dl,0
jne ._01
mov edi,lstart
jmp @f
._01:
mov edi,rstart
@@:
push edx
xor ebp,ebp
mov dword[f_info],FS_READ ; read
mov dword[f_info+8],1 ; 1 block
mov dword[f_info+12],read_area ; to read_area
.next_block:
mov dword[f_info+4],ebp ; starting from block #ebp
mcall MF_FSACCESS,f_info
cmp eax,ERR_SUCCESS
je @f
cmp eax,ERR_FS_LAST
ja @f
jmp .exit
@@:
mov esi,read_area
mov ecx,16
.next_file:
cmp word[esi],0 ; end of entries
je .exit
cmp word[esi],'. ' ; self-pointer
je .skip
test byte[esi+11],FA_LABEL ; disk label
jnz .skip
cmp byte[esi+11],$0F ; fat32
je .skip
cmp byte[esi],$E5 ; erased
je .skip
mov eax,[esi+28] ; add file size
add [d_ttsz],eax ; to folder size
push ecx
mov ecx,3
rep movsd ; copy name, attriputes
mov [edi],ebp ; and block number
add edi,4
add esi,20
inc [d_tcnt] ; increase folder files counter
; cmp [d_tcnt],max_cnt
; je .exit
pop ecx
jmp @f
.skip:
add esi,32
@@:
loop .next_file
 
cmp [d_tcnt],max_cnt
je .exit
inc ebp
jmp .next_block
.exit:
pop edx
push [d_ttsz]
mov eax,[d_tcnt]
cmp dl,0
jne ._02
mov [d_lcnt],eax
pop [d_ltsz]
jmp @f
._02:
mov [d_rcnt],eax
pop [d_rtsz]
@@:
popad
mov al,dl
call mfar_sort
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func execute_current_file
pushad
cmp [active_panel],0
jne ._00
mov esi,[d_lpos]
shl esi,4
add esi,lstart
mov edi,f_path0
mov ecx,f_plen0
jmp @f
._00:
mov esi,[d_rpos]
shl esi,4
add esi,rstart
mov edi,f_path1
mov ecx,f_plen1
@@:
call get_file_info
test byte[esi+11],FA_FOLDER
jz .file
cmp word[esi],'..'
jne .enter_dir
add edi,[ecx]
dec edi
@@:
dec [f_plen1]
cmp byte[edi],'/'
je @f
dec edi
jmp @b
@@:
mov dword[edi],0
jmp @f
.enter_dir:
add edi,[ecx]
push ecx edi
mov byte[edi],'/'
inc edi
mov esi,file_info
mov ecx,3
cld
rep movsd
mov dword[edi],0
pop esi ecx
sub edi,esi
add dword[ecx],edi
mov [d_rpos],0
mov [d_rtop],0
@@:
mov dl,[active_panel]
call get_files_data
call draw_path
mov al,dl
call draw_files
jmp .exit
.file:
mov eax,[esi+8]
shl eax,8
and eax,$FFFFFF00
or eax,$00000020
cmp eax,' '
jne .exit
 
mov esi,edi
mov eax,[ecx]
mov edi,f_pathn
call get_normal_path
mov esi,f_pathn
mov ecx,[len]
dec ecx
mov edi,f_info.path
rep movsb
mov byte[edi],'/'
inc edi
mov esi,file_info
@@:
movsb
cmp byte[esi],0
je @f
cmp byte[esi],' '
jne @b
@@:
mov byte[edi],0
mov dword[f_info],FS_EXECUTE
mov dword[f_info+12],0
mcall MF_FSACCESS,f_info
.exit:
popad
ret
endf
 
;------------------------------------------------------------------------------
;//////////////////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
func delete_current_file
pushad
popad
ret
endf
 
;------------------------------------------------------------------------------
;///// INCLUDES ///////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
include 'mf-copy.inc'
include 'mf-sort.inc'
 
;------------------------------------------------------------------------------
;///// DATA ///////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
align 4
 
f_size dd ?
f_day db ?
f_mnth db ?
f_year dw ?
 
d_lpos dd 0
d_ltop dd 0
d_lcnt dd 0
d_ltsz dd 0
d_rpos dd 0
d_rtop dd 0
d_rcnt dd 0
d_rtsz dd 0
d_tpos dd ?
d_ttop dd ?
d_tcnt dd ?
d_ttsz dd ?
 
f_info:
dd 0
dd 0
dd ?
dd read_area
dd MEM_FOR_OS
.path:
rb 200
 
f_plen0 dd 5
f_plen1 dd 5
 
sz caption,'MFAR : PRE-ALPHA-8.1'
sz fcfile,'MFAR DAT'
sz p_hd,'/HD/1',0
sz p_rd,'/RD/1',0
ext0:
db ' EXE COM BAT CMD'
dd 0
ext1:
db ' BMP GIF JPG PNG WMF'
dd 0
ext2:
db ' ASM INC'
dd 0
 
;----- LANGUAGE-SPECIFIC STRINGS -----
include 'mf-lang.inc'
;-------------------------------------
 
f_name: rb 12
file_info: db ' . .'
active_panel db 0
;---------------------------------
 
sel_color = $00008080
 
FPC = 18
 
MEM_FOR_OS = $48300
MEM_USED = $4C300
read_area = $48000
fdata_size = $40000-$300
max_cnt = fdata_size/32
lstart = $8000+$300
rstart = lstart+max_cnt*16
 
f_path0 = $8000
f_path1 = $8000+$100
f_pathn = $8000+$200
 
align 4
 
sc system_colors
fc mfar_colors
 
I_END:
; 16 bytes per entry:
; -> 8 bytes - name
; -> 3 bytes - extension
; -> 1 byte - attributes
; -> 4 bytes - block number
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/mfar.inc
0,0 → 1,147
oX = 6
oY = 22+3
tW = 6
tH = 9
 
VK_TAB = 9
VK_RETURN = 13
VK_ESCAPE = 27
VK_F10 = 49
VK_F5 = 54
VK_LEFT = 176
VK_DOWN = 177
VK_UP = 178
VK_RIGHT = 179
VK_HOME = 180
VK_END = 181
VK_PGDOWN = 183
VK_PGUP = 184
 
VK_CTRLF3 = 212
VK_CTRLF4 = 213
 
FA_READONLY = 00000001b
FA_HIDDEN = 00000010b
FA_SYSTEM = 00000100b
FA_LABEL = 00001000b
FA_FOLDER = 00010000b
FA_ARCHIVED = 00100000b
 
struc mfar_colors {
.background dd $00000080
.default dd $0000FFFF
.system dd $00008080
.selection dd $00009090
.folder dd $00FFFFFF
.executable dd $0000FF00
.bitmap dd $00FF00FF
.source dd $00FF0000
.path dd $00C0C0C0
.pathbg dd $00000000
.keys dd $00000000
.keysbg dd $00008080
}
struct mfar_colors
 
macro __mov reg,a {
if ~a 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 $40
}
 
macro mcall1 a,b1,b2,c,d,e,f {
__mov eax,a
if (~b1 eq)|(~b2 eq)
mov ebx,(b1)*65536+(b2)
end if
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int $40
}
 
macro mcall2 a,b1,b2,c1,c2,d,e,f {
__mov eax,a
if (~b1 eq)|(~b2 eq)
mov ebx,(b1)*65536+(b2)
end if
if (~c1 eq)|(~c2 eq)
mov ecx,(c1)*65536+(c2)
end if
__mov edx,d
__mov esi,e
__mov edi,f
int $40
}
 
macro sz name,[data] {
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] {
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
macro mmov reg,a1,a2 {
mov reg,(a1)*65536+a2
}
 
macro madd reg,a1,a2 {
add reg,(a1)*65536+a2
}
 
macro msub reg,a1,a2 {
sub reg,(a1)*65536+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
label name
}
 
macro endf {
end if
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mfar/trunk/readme.txt
0,0 → 1,80
 
; MFAR pre-alpha 8.1
; 2003-2004 (C) Semenyako Mike a.k.a. mike.dld
; e-mail: mike.dld@tut.by
 
;------------------------------------------------------------------------------
;///// ENGLISH ////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
---[ ATTENTION ]---------------------------------------------------------------
This MFAR version is far from being RELEASE!
So, use it carefully, paying special attention to the new features.
 
---[ ABOUT ]-------------------------------------------------------------------
MFAR was intended as SYSTREE-alternative & at the same time as file-manager
with well-known & handy interface for MenuetOS. It'll be look like FAR
(farmanager.com) which i really like BTW.
 
---[ FEATURES ]----------------------------------------------------------------
- displaying RD (left) & HD (right) file structure
- color highlighting for files (depending on their extensions)
- sotring (by name or extension)
- selected file info: date, size
- MeOS apps execution
 
---[ TODO ]--------------------------------------------------------------------
- copying (moving), deleting files
- disk selection
- other sort types
- not only apps execution
- ...
 
---[ HOTKEYS ]-----------------------------------------------------------------
Up, Down, Left, Right, Home, End - if you worked in any DOS-based file-
manager (NC, VC, DN, ...), even a few minutes, you may know that this
keys direct the caret (light pen)
F5 - copy !FILE! from one panel to another (in development)
F10 - exit program
Ctrl+F3 - sort by name
Ctrl+F4 - sort by extension
 
;------------------------------------------------------------------------------
;///// “‘‘Šˆ‰ ////////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
 
---[ ‚­¨¬ ­¨¥ ]----------------------------------------------------------------
âã ¢¥àá¨î MFAR ­¨ª ª ­¥«ì§ï áç¨â âì ५¨§®¬!
à®£à ¬¬  ­ å®¤¨âáï ¢ ࠧࠡ®âª¥ ¨ ï ®ç¥­ì ᮦ «¥î ® ⮬, çâ® ­¥ ¢ ᨫ å
¯®ª  çâ® ¯à¥¤áâ ¢¨âì ‚ ¬ ¯®«­®æ¥­­ë© ä ©«-¬¥­¥¤¦¥à, å®âï ¡ë ¯à¨¡«¨§¨â¥«ì­®
áà ¢­¨¬ë© ¯® ä㭪樮­ «ì­ë¬ ¢®§¬®¦­®áâï¬ á  ­ «®£¨ç­ë¬¨ ¯à®¥ªâ ¬¨ ¯®¤ *nix
¨ *dows.
 
---[ Ž ¯à®£à ¬¬¥ ]-------------------------------------------------------------
MFAR ¡ë« § ¤ã¬ ­ ª ª  «ìâ¥à­ â¨¢  SYSTREE ¨ ®¤­®¢à¥¬¥­­® ª ª ä ©«-¬¥­¥¤¦¥à
á® §­ ª®¬ë¬ ¨ 㤮¡­ë¬ ¨­â¥à䥩ᮬ ¯®¤ MenuetOS. ˆ§ ­ §¢ ­¨ï ¬®¦­® ¤®£ ¤ âìáï,
çâ® ¢­¥è­¨© ¢¨¤ ¯à®£à ¬¬ë ¡ã¤¥â ­¥ ®á®¡® ®â«¨ç âìáï ®â FAR'  (farmanager.com),
®ç¥­ì, ªáâ â¨, ¬­®î «î¡¨¬®£® ¨ 㢠¦ ¥¬®£® ¯à®¥ªâ .
 
---[ —â® ᤥ« ­® ]-------------------------------------------------------------
- ®â®¡à ¦¥­¨¥ ä ©«®¢®© áâàãªâãàë ®¡à §  (á«¥¢ ) ¨ †„ (á¯à ¢ )
- ¯®¤á¢¥âª  ¨¬¥­ ä ©«®¢ à §­ë¬¨ 梥⠬¨ (¢ § ¢¨á¨¬®á⨠®â ä®à¬ â )
- á®àâ¨à®¢ª  (¯® ¨¬¥­¨ ¨«¨ à áè¨à¥­¨î)
- à §¬¥à ¨ ¤ â  ᮧ¤ ­¨ï (¨§¬¥­¥­¨ï) ¤«ï ¢ë¤¥«¥­­®£® ä ©« 
- § ¯ã᪠¨á¯®«­ï¥¬ëå ä ©«®¢
 
---[ —â® å®â¥«®áì ¡ë ᤥ« âì ]-------------------------------------------------
- ª®¯¨à®¢ ­¨¥ (¯¥à¥¬¥é¥­¨¥), 㤠«¥­¨¥ ä ©«®¢
- ¢ë¡®à  ªâ¨¢­®£® ¤¨áª  ¤«ï ¯ ­¥«¥©
- ¤à㣨¥ ¢¨¤ë á®àâ¨à®¢®ª
- § ¯ã᪠­¥ ⮫쪮 ¨á¯®«­ï¥¬ëå ä ©«®¢
- ...
 
---[ ‘®ç¥â ­¨ï ª« ¢¨è ]--------------------------------------------------------
Up, Down, Left, Right, Home, End - ªâ® å®âï ¡ë à § à ¡®â « ¢ „Ž‘®¢áª®¬
ä ©«-¬¥­¥¤¦¥à¥ (NC, VC, DN, ...) §­ ¥â, çâ® á ¯®¬®éìî íâ¨å ª« ¢¨è ¬®¦­®
ã¯à ¢«ïâì ¯®«®¦¥­¨¥¬ ªãàá®à  (ᢥ⮢®£® ¯¥à )
F5 - ª®¯¨à®¢ âì ä ©« ¨§ ®¤­®© ¯ ­¥«¨ ¢ ¤àã£ãî (¢ ࠧࠡ®âª¥)
F10 - ¢ë室 ¨§ ¯à®£à ¬¬ë
Ctrl+F3 - á®àâ¨à®¢ âì ¯® ¨¬¥­¨
Ctrl+F4 - á®àâ¨à®¢ âì ¯® à áè¨à¥­¨î
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mhc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mhc.asm mhc
@pause
/programs/mhc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mhc.asm mhc
@pause
/programs/mhc/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mhc/trunk/mhc.asm
0,0 → 1,977
;
; MHC archiver for MenuetOS - very fast compression tool
;
; version 0.09
;
; Written by Nikita Lesnikov (nlo_one@mail.ru, Republic of Belarus, Sluck)
;
 
;==============================================================================
 
;
; Brief file format description:
;
; +-----------+------------------------+
; File structure: | Method ID | Compressed data |
; +-----------+------------------------+
;
; Methods list:
;
; 0. LZP (order-2 specified specially for *.ASM,*.RAW and MeOS executables)
;
; New methods can be easily added without loss of compatibility
; with older versions
;
 
;==============================================================================
 
; SYSTEM HEADER
 
use32
 
org 0x0
db "MENUET01"
dd 0x01
dd ENTRANCE
dd MHC_END
dd 0x300000 ; 3 megs of memory needed
dd 0x2FF000
dd 0x0
dd 0x0
 
include 'lang.inc'
include 'macros.inc'
; CODE AREA
 
ENTRANCE:
 
; ======== user interface =========
 
 
call draw_window ; draw the window
 
still:
 
mov eax,10 ; wait for event
int 0x40
 
cmp eax,1 ; redraw?
jnz no_redraw
call draw_window
no_redraw:
 
cmp eax,2 ; key pressed?
jz key
 
cmp eax,3 ; button pressed?
jz button
 
jmp still
 
; Key handler
 
key:
mov eax,2 ; read it
int 0x40
shr eax,8
 
cmp byte [editstate],0
jz still
 
cmp al,8 ; backspace
jnz no_bksp
cmp byte [editpos],0
jz no_del_last
dec byte [editpos]
xor ebx,ebx
mov bl,byte [editpos]
add ebx,cmfile
cmp byte [editstate],2
jnz no_add_base_1
add ebx,12
no_add_base_1:
mov byte [ebx],32
no_del_last:
call draw_info
jmp still
no_bksp:
 
cmp al,13 ; enter
jnz no_enter
mov byte [editstate],0
call draw_info
jmp still
no_enter:
 
cmp eax,dword 31
jbe no_lit
cmp eax,dword 95
jb capital
sub eax,32
capital:
xor ebx,ebx
mov bl,byte [editpos]
add ebx,cmfile
cmp byte [editstate],2
jnz no_add_base_2
add ebx,12
no_add_base_2:
mov byte [ebx],al
inc byte [editpos]
cmp byte [editpos],12
jnz no_null_state
mov byte [editstate],0
no_null_state:
call draw_info
no_lit:
 
jmp still
 
; Button handler
 
button:
 
mov eax,17
int 0x40
 
cmp ah,1
jnz no_quit
mov eax,-1
int 0x40
no_quit:
 
cmp ah,4
jnz nofirst
cld
mov byte [editstate],1
mov edi,cmfile
mov eax,0x20202020
mov ecx,3
rep stosd
mov byte [editpos],0
mov byte [msgid],0
call draw_info
nofirst:
 
cmp ah,5
jnz nosecond
cld
mov byte [editstate],2
mov edi,iofile
mov eax,0x20202020
mov ecx,3
rep stosd
mov byte [editpos],0
mov byte [msgid],0
call draw_info
nosecond:
 
cmp ah,2
jnz no_compress
call compress
no_compress:
 
cmp ah,3
jnz no_decompress
call decompress
no_decompress:
 
cmp ah,6
jnz no_delete_io
pusha
mov eax,32
mov ebx,iofile
int 0x40
popa
no_delete_io:
 
cmp ah,7
jnz no_delete_archive
pusha
mov eax,32
mov ebx,cmfile
int 0x40
popa
no_delete_archive:
 
jmp still
 
; WINDOW DRAW
 
draw_window:
 
mov eax,12 ; Start redrawing
mov ebx,1
int 0x40
 
xor eax,eax ; Define window
mov ebx,100*65536+240
mov ecx,100*65536+130
mov edx,0x02AAAAAA
mov esi,0x80777777
mov edi,0x00777777
int 0x40
 
mov eax,4 ; Draw all needed texts
mov ebx,8*65536+8
mov ecx,0x00FFFFFF
mov edx,title
mov esi,arclab-title
int 0x40
 
xor ecx,ecx
mov edx,arclab
mov esi,unplab-arclab
add ebx,10*65536+28
int 0x40
 
mov edx,unplab
mov esi,fin_text-unplab
add ebx,18
int 0x40
 
pusha
 
mov eax,8 ; Buttons
mov ebx,222*65536+10
mov ecx,6*65536+10
mov edx,1
mov esi,0x555555
int 0x40
 
mov ebx,15*65536+100
mov ecx,70*65536+13
inc edx
int 0x40
 
inc edx
add ebx,110*65536
int 0x40
 
inc edx
mov ebx,214*65536+11
mov ecx,33*65536+11
int 0x40
 
inc edx
add ecx,18*65536
int 0x40
 
inc edx
mov ebx,15*65536+100
mov ecx,86*65536+13
int 0x40
 
inc edx
add ebx,110*65536
int 0x40
 
popa
 
mov ecx,0x00FFFFFF
mov edx,keylab
mov esi,dellab-keylab
add ebx,19
int 0x40
 
mov edx,dellab
mov esi,title-dellab
add ebx,16
int 0x40
 
call draw_info
 
mov eax,12 ; Finish redrawing
mov ebx,2
int 0x40
 
ret
 
draw_info: ; Draw filenames and compressor state
 
activecolor equ 0x00112299
 
pusha ; Save registers
 
mov eax,13 ; Clean draw area
mov ebx,127*65536+85
mov ecx,33*65536+33
mov edx,0x00AAAAAA
int 0x40
 
mov eax,4 ; Draw filenames
mov ebx,134*65536+36
mov edx,cmfile
xor ecx,ecx
mov esi,12
cmp byte [editstate],1
jnz no_active_1
mov ecx,activecolor
no_active_1:
int 0x40
xor ecx,ecx
cmp byte [editstate],2
jnz no_active_2
mov ecx,activecolor
no_active_2:
add ebx,18
add edx,12
int 0x40
 
mov eax,13 ; Clean info area
mov ebx,14*65536+210
mov ecx,107*65536+14
mov edx,0x00AAAAAA
int 0x40
 
cmp byte [msgid],0 ; Draw info string
jz notype
mov ebx,16*65536+110
xor ecx,ecx
mov esi,16
mov al, byte [msgid]
dec al
shl al,4
xor ah,ah
xor edx,edx
mov dx,ax
add edx,msgtable
mov eax,4
int 0x40
notype:
 
popa ; Restore registers
 
ret
 
; interface data
 
keylab db " COMPRESS DECOMPRESS"
dellab db " DELETE I/O DELETE *.MHC"
title db "MHC 0.09"
arclab db "COMPRESSED FILE:"
unplab db "INPUT/OUTPUT FILE:"
fin_text:
 
cmfile db "FILENAME.MHC"
iofile db "FILENAME.XYZ"
 
editstate db 0
editpos db 0
msgid db 0
 
msgtable:
db "COMPRESSING... "
db "DECOMPRESSING..."
db "I/O NOT FOUND! "
db "*.MHC NOT FOUND!"
db "INVALID METHOD! "
 
; ======== compression/decompression engine ========
 
; Adresses declaration
 
hashtable equ MHC_END
ifile equ hashtable+65536*4
ofile equ ifile+1000000
 
compress: ; File compression
 
call fill_filebufs
 
mov eax,6
mov ebx,iofile
xor ecx,ecx
mov edx,ecx
not edx
mov esi,ifile
int 0x40
 
cmp eax,0xFFFFFFFF
jnz compress_filefound ; i/o file not found
mov byte [msgid],3
call draw_info
ret
 
compress_filefound:
 
mov byte [msgid],1
call draw_info
 
jmp lzp_compress ; compress with order-2 LZP
compress_dumpdata:
 
push edx
 
mov eax,32
mov ebx,cmfile
int 0x40
 
mov eax,33
pop edx
mov ebx,cmfile
mov ecx,ofile
xor esi,esi
int 0x40
 
mov byte [msgid],0
call draw_info
 
ret
 
 
decompress: ; File decompression
 
call fill_filebufs
 
mov eax,6
mov ebx,cmfile
xor ecx,ecx
mov edx,ecx
not edx
mov esi,ofile
int 0x40
 
cmp eax,0xFFFFFFFF
jnz decompress_filefound ; *.mhc file not found
mov byte [msgid],4
call draw_info
ret
 
decompress_filefound:
 
cmp byte [ofile],0 ; Invalid method!
jz right_method
mov byte [msgid],5
call draw_info
ret
 
right_method:
mov byte [msgid],2
call draw_info
 
jmp lzp_decompress
decompress_dumpdata:
 
push edx
 
mov eax,32
mov ebx,iofile
int 0x40
 
mov eax,33
pop edx
mov ebx,iofile
mov ecx,ifile
xor esi,esi
int 0x40
 
mov byte [msgid],0
call draw_info
 
ret
 
fill_filebufs: ; Fill filebufs with garbage to simplify matching
pusha
cld
mov eax,0xF7D9A03F ; <- "magic number" :) just garbage...
mov ecx,2000000/4
mov edi,ifile
rep stosd
popa
ret
 
; ==== algorithms section ====
 
; Method 0: LZP compression algorithm
 
lzp_compress: ; EDX - how much bytes to dump
 
cld ; clear direction flag
 
mov esi,ifile ; init pointers
mov edi,ofile
 
push eax ; write header: ID0+4bfilesize => total 5 bytes
xor eax,eax
stosb
pop eax
stosd
 
pusha ; fill hash table
mov eax,ifile
mov edi,hashtable
mov ecx,65536
rep stosd
popa
 
add eax,esi ; calculate endpointer
mov dword [endpointer],eax
 
movsw ; copy three bytes
movsb
 
mov dword [controlp],edi
inc edi
 
mov byte [controld],0
mov byte [controlb],0
 
c_loop:
cmp dword [endpointer],esi ; check end of file
ja c_loop_ok
jmp finish_c_loop
c_loop_ok:
 
call chash
call compare
jz two_match_c
 
lodsb
mov byte [literal],al
call chash
call compare
jz lit_match_c
 
mov al,0
call putbit
mov al,byte [literal]
stosb
movsb
jmp end_c_loop
 
lit_match_c:
mov al,1
call putbit
mov al,0
call putbit
mov al,byte [literal]
stosb
jmp encode_match
 
two_match_c:
mov al,1
call putbit
call putbit
 
encode_match:
call incpos
call compare
jz one_c
mov al,0
call putbit
jmp end_c_loop
one_c:
 
call incpos
mov al,1
call putbit
 
call compare
jnz ec1
call incpos
call compare
jnz ec2
call incpos
call compare
jnz ec3
call incpos
mov al,1
call putbit
call putbit
call compare
jnz ec4
call incpos
call compare
jnz ec5
call incpos
call compare
jnz ec6
call incpos
call compare
jnz ec7
call incpos
call compare
jnz ec8
call incpos
call compare
jnz ec9
call incpos
call compare
jnz ec10
call incpos
 
mov al,1
call putbit
call putbit
call putbit
xor ecx,ecx
 
match_loop_c:
cmp esi,dword [endpointer]
jae out_match_loop_c
call compare
jnz out_match_loop_c
inc ecx
call incpos
jmp match_loop_c
out_match_loop_c:
 
mov al,0xFF
out_lg:
cmp ecx,255
jb out_lg_out
stosb
sub ecx,255
jmp out_lg
out_lg_out:
mov al,cl
stosb
jmp end_c_loop
 
ec10:
mov al,1
call putbit
call putbit
mov al,0
call putbit
jmp end_c_loop
 
ec9:
mov al,1
call putbit
mov al,0
call putbit
mov al,1
call putbit
jmp end_c_loop
 
ec8:
mov al,1
call putbit
mov al,0
call putbit
call putbit
jmp end_c_loop
 
ec7:
mov al,0
call putbit
mov al,1
call putbit
call putbit
jmp end_c_loop
 
ec6:
mov al,0
call putbit
mov al,1
call putbit
mov al,0
call putbit
jmp end_c_loop
 
ec5:
mov al,0
call putbit
call putbit
mov al,1
call putbit
jmp end_c_loop
 
ec4:
mov al,0
call putbit
call putbit
call putbit
jmp end_c_loop
 
ec3:
mov al,1
call putbit
mov al,0
call putbit
jmp end_c_loop
 
ec2:
mov al,0
call putbit
mov al,1
call putbit
jmp end_c_loop
 
ec1:
mov al,0
call putbit
call putbit
 
end_c_loop:
jmp c_loop
 
finish_c_loop:
 
mov eax,dword [controlp] ; store last tagbyte
mov bl,byte [controld]
mov [eax], byte bl
 
sub edi,ofile ; calculate dump size
mov edx,edi
 
jmp compress_dumpdata
 
; LZP decompression algorithm
 
lzp_decompress: ; EDX - how much bytes to dump
 
cld
 
mov edi,ifile
mov esi,ofile+1
 
pusha ; fill hash table
mov eax,ifile
mov edi,hashtable
mov ecx,65536
rep stosd
popa
 
lodsd
 
mov ebx,edi
add ebx,eax
mov dword [endpointer],ebx
 
movsw
movsb
 
lodsb
mov byte [controld],al
mov byte [controlb],0
 
d_loop:
cmp dword [endpointer],edi
ja d_loop_ok
jmp finish_d_loop
d_loop_ok:
 
call getbit
cmp al,0
jnz match_d
call dhash
movsb
call dhash
movsb
jmp end_d_loop
 
match_d:
 
call getbit
cmp al,0
jnz no_literal_before_match
call dhash
movsb
no_literal_before_match:
 
call dhash
mov ecx,1
call copymatch
 
call getbit
cmp al,0
jz end_d_loop
mov ecx,1
call copymatch
call getbit
cmp al,0
jz dc2
mov ecx,2
call copymatch
call getbit
cmp al,0
jz end_d_loop
mov ecx,1
call copymatch
call getbit
cmp al,0
jz dc4
mov ecx,4
call copymatch
call getbit
cmp al,0
jz dc5
call getbit
cmp al,0
jz dc6
mov ecx,3
call copymatch
 
do:
lodsb
xor ecx,ecx
mov cl,al
call copymatch
cmp al,0xFF
jnz end_do
jmp do
end_do:
jmp end_d_loop
 
dc6:
mov ecx,2
call copymatch
jmp end_d_loop
 
dc5:
call getbit
cmp al,0
jz ndc5
mov ecx,1
call copymatch
ndc5:
jmp end_d_loop
 
dc4:
call getbit
cmp al,0
jz ndc4
call getbit
mov ecx,3
cmp al,1
jz ndcc4
dec ecx
ndcc4:
call copymatch
jmp end_d_loop
ndc4:
call getbit
cmp al,0
jz ndccc4
mov ecx,1
call copymatch
ndccc4:
jmp end_d_loop
 
dc2:
call getbit
cmp al,0
jz ndc2
mov ecx,1
call copymatch
ndc2:
 
end_d_loop:
jmp d_loop
finish_d_loop:
 
mov edx, dword [ofile+1]
 
jmp decompress_dumpdata
 
; LZP subroutines
 
putbit: ; bit -> byte tag, AL holds bit for output
pusha
mov cl,byte [controlb]
shl al,cl
mov bl,byte [controld]
or bl,al
mov byte [controld],bl
inc cl
cmp cl,8
jnz just_increment
mov byte [controlb],0
mov byte [controld],0
push edi
mov edi, dword [controlp]
mov al,bl
stosb
pop edi
mov dword [controlp],edi
popa
inc edi
ret
just_increment:
mov byte [controlb],cl
popa
ret
 
getbit: ; tag byte -> bit, AL holds input
push ecx
mov al,byte [controld]
mov cl,byte [controlb]
shr al,cl
and al,1
inc cl
cmp cl,8
jnz just_increment_d
mov byte [controlb],0
push eax
lodsb
mov byte [controld],al
pop eax
pop ecx
ret
just_increment_d:
mov byte [controlb],cl
pop ecx
ret
 
chash: ; calculate hash -> mp -> fill position
pusha
xor eax,eax
mov al, byte [esi-1]
mov ah, byte [esi-2]
shl eax,2
add eax,hashtable
mov edx,dword [eax]
mov dword [mp],edx
mov dword [eax],esi
popa
ret
 
dhash: ; calculate hash -> mp -> fill position
pusha
xor eax,eax
mov al, byte [edi-1]
mov ah, byte [edi-2]
shl eax,2
add eax,hashtable
mov edx,dword [eax]
mov dword [mp],edx
mov dword [eax],edi
popa
ret
 
copymatch: ; ECX bytes from [mp] to [rp]
push esi
mov esi,dword [mp]
rep movsb
mov dword [mp],esi
pop esi
ret
 
compare: ; compare [mp] with [cpos]
push edi
push esi
mov edi,dword [mp]
cmpsb
pop esi
pop edi
ret
 
incpos:
inc dword [mp]
inc esi
ret
 
 
; LZP algorithm data
 
endpointer dd 0
controlp dd 0
controlb db 0
controld db 0
mp dd 0
literal db 0
 
MHC_END: ; the end... - Nikita Lesnikov (nlo_one)
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/midiplay/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm midiplay.asm midiplay
@pause
/programs/midiplay/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm midiplay.asm midiplay
@pause
/programs/midiplay/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/midiplay/trunk/midiplay.asm
0,0 → 1,255
;
; Ok, this is the sceleton that MENUET 0.01 understands.
; Do not change the header bits for now. Compile with nasm.
;
 
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 0x1000 ; reguired amount of memory
dd 0x1000
dd 0x00000000 ; reserved=no extended header
 
 
 
START:
 
call draw_window
 
still:
 
mov eax,10 ; redraw ?
int 0x40
 
cmp eax,1
jz red
cmp eax,3
jz button
jmp still
 
red:
call draw_window
jmp still
 
button:
mov eax,17
int 0x40
 
cmp al,byte 0
jnz still
 
cmp ah,1
jnz noexit
 
mov eax,0xffffffff
int 0x40
 
noexit:
 
cmp ah,2
jz note1
 
mov eax,20 ; reset midi device
mov ebx,1
mov ecx,0
int 0x40
 
cmp eax,0
jz noe1
 
call printerror
 
noe1:
 
jmp still
 
note1:
 
mov eax,50
 
nn:
 
mov ebx,100
call noteout
pusha
mov eax,5
mov ebx,8
int 0x40
popa
mov ebx,0
; call noteout
 
add eax,3
 
mov ebx,100
call noteout
pusha
mov eax,5
mov ebx,8
int 0x40
popa
mov ebx,0
; call noteout
 
add eax,4
 
inc eax
cmp eax,90
jbe nn
 
jmp still
 
 
draw_window:
 
pusha
 
mov eax,12 ; tell os about redraw
mov ebx,1
int 0x40
 
mov eax,0 ; define and draw window
mov ebx,20*65536+250
mov ecx,20*65536+120
mov edx,0x02ffffff
mov esi,0x805070d0;88ccee
mov edi,0x005070d0;88ccee
int 0x40
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw
mov ebx,(250-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,0x5577cc ; button color RRGGBB
int 0x40
 
 
mov eax,4 ; 4 = write text
mov ebx,8*65536+8
mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
mov eax,8
mov ebx,10*65536+200 ; button start x & size
mov ecx,40 *65536+17 ; button start y & size
mov edx,2 ; button number
mov esi,0x4060b0 ; button color
int 0x40
 
mov eax,8
mov ebx,10*65536+200 ; button start x & size
mov ecx,60 *65536+17 ; button start y & size
mov edx,3 ; button number
mov esi,0x4060b0 ; button color
int 0x40
 
mov eax,dword 4
mov ebx,25*65536+45
mov ecx,dword 0xffffff
mov edx,buttont
mov esi,buttontlen-buttont
int 0x40
 
mov eax,dword 4
mov ebx,25*65536+65
mov ecx,dword 0xffffff
mov edx,buttont2
mov esi,buttontlen2-buttont2
int 0x40
 
mov eax,12 ; tell os about redraw end
mov ebx,2
int 0x40
 
popa
ret
 
 
noteout:
 
pusha
 
push ebx
push eax
 
mov eax,20
mov ebx,2
mov ecx,0x9f
int 0x40
mov eax,20
mov ebx,2
pop ecx
int 0x40
mov eax,20
mov ebx,2
pop ecx
int 0x40
 
cmp eax,0
jz noe2
 
call printerror
 
noe2:
 
popa
ret
 
printerror:
 
mov eax,dword 4
mov ebx,15*65536+85
mov ecx,0x000000
mov edx,error1
mov esi,errorlen1-error1
int 0x40
 
mov eax,dword 4
mov ebx,15*65536+95
mov ecx,0x000000
mov edx,error2
mov esi,errorlen2-error2
int 0x40
 
ret
 
 
; DATA AREA
 
 
labelt:
db 'MIDI TEST'
labellen:
 
buttont:
db 'PLAY A FEW NOTES'
buttontlen:
buttont2:
db 'RESET MIDI DEVICE'
buttontlen2:
 
error1:
db 'NO BASE DEFINED FOR MPU-401'
errorlen1:
 
error2:
db 'USE SETUP AND RESET MIDI DEVICE.'
errorlen2:
 
base db 0x0
 
 
I_END:
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mine/trunk/access.h--
0,0 → 1,68
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
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
 
*******************************************************************************/
 
:int get_value(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].value;
}
 
:void set_value(int x, y, byte val)
{
EBX=x*ncy+y;
massiv[EBX].value=val;
}
 
:int get_open(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].open;
}
 
:void set_open(int x, y, byte op)
{
EBX=x*ncy+y;
massiv[EBX].open=op;
}
 
:int get_press(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].press;
}
 
:void set_press(int x, y, byte pr)
{
EBX=x*ncy+y;
massiv[EBX].press=pr;
}
 
:int get_mark(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].mark;
}
 
:void set_mark(int x, y, byte mar)
{
EBX=x*ncy+y;
massiv[EBX].mark=mar;
}
/programs/mine/trunk/changelog.txt
0,0 → 1,15
v0.3a (11/08/2003)
- fixed a bug on old kernels
 
v0.3 (09/08/2003)
- fixed some bugs
- new timer
- better random number generator
- user can't blow up after first mouse click
- uses system colors
 
v0.2 (29/06/2003)
- fixed a lot of bugs
 
v0.1 (22/06/2003)
- first public version
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mine/trunk/draw.h--
0,0 → 1,184
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
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
 
*******************************************************************************/
 
void draw_window()
// Ïðîöåäóðà îòðèñîâêè îêíà
{
mouse_disable();
 
sys_window_redraw(1);
sys_get_colors(#colors, 40);
 
// WINDOW
EBX = xpos << 16 + xsize;
ECX = ypos << 16 + ysize;
sys_draw_window(EBX, ECX, 0x02CCCCCC, colors.w_grab | 0x80000000, colors.w_frames);
 
// LABEL
sys_write_text(8<<16+8, colors.w_grab_text | 0x10000000, "MeOS MineSweeper", 16);
 
// <CLOSE> BUTTON (1)
EBX = xsize - 19; EBX = EBX<<16 + 12;
sys_draw_button(EBX, 5<<16+12, 1, colors.w_grab_button);
 
// <NEW GAME> BUTTON (911)
EBX = xsize / 2 - 10;
EBX = EBX << 16 + 20;
sys_draw_button(EBX, 25<<16+20, 911, clLightGray);
 
// <CHANGE MODE> BUTTON (1001)
sys_draw_button(10<<16+7, 23<<16+7, 1001, 0x118811);
 
// <USER FIELD> BUTTON (1002)
//sys_draw_button(20<<16+7, ECX, EDX+1, 0xddbb44);
 
// <OPTIONS> BUTTON (1003)
// sys_draw_button();
 
// <SCORES> BUTTON (1004)
// sys_draw_button();
 
// <ABOUT> BUTTON (1005)
// sys_draw_button();
 
sys_window_redraw(2);
 
draw_time(); // draw timer
draw_minesi(); // draw mines
draw_squares(); // draw field
 
mouse_enable();
}
 
dword num_colors[8]=
{
0x4444d0, // 1
0x118811, // 2
0xd04444, // 3
0x111199, // 4
0x991111, // 5
0x117089, // 6
0x000000, // 7
0x808080 // 8
};
 
void draw_square(int x, y)
// Îòðèñîâêà îäíîé êëåòêè
{
int xl, xr, yt, yb;
dword tcolor = clBlack;
byte tchar,tval;
 
xl = XPX * x + XST;
xr = xl + XPX - 1;
yt = YPX * y + YST;
yb = yt + YPX - 1;
 
EBX = xl << 16 + xr - xl;
ECX = yt << 16 + yb - yt;
$inc ebx
$inc ecx
sys_draw_bar(EBX, ECX, clLightGray);
 
if (!get_open(x, y))
{
ECX = yt << 16 + yb - 1;
sys_draw_line(xl<<16+xl, ECX, clWhite);
EBX = xl << 16 + xr - 1;
sys_draw_line(EBX, yt << 16 + yt, EDX);
sys_draw_line(xr << 16 + xl, yb << 16 + yb, clDarkGray);
sys_draw_line(xr << 16 + xr, yb << 16 + yt, EDX);
 
SWITCH (get_mark(x, y))
{
CASE 2: tcolor = 0x121288; tchar = '?'; BREAK;
CASE 1: tcolor = 0xd04444; tchar = 'P';
}
 
IF (get_mark(x,y))
{
EBX = xl + 5; EBX <<= 16; EBX += yt + 4;
sys_write_text(EBX, tcolor, #tchar, 1);
EBX += 0x00010000;
/* Âòîðîé ðàç - ðåãèñòðû ñîõðàíÿþòñÿ */
sys_write_text(EBX, ECX, EDX, ESI);
}
}
else // get_open(x,y)==TRUE
{
tval = get_value(x, y);
IF (tval == 0)
{
//tcolor=clLightGray;
//tchar=' ';
GOTO NOCHAR;
}
ELSE IF (tval == MINE)
{
tcolor = 0xee1111;
tchar = '*';
}
ELSE
{
tchar = tval + '0';
tcolor = num_colors[tval-1];
}
 
EBX = xl + 5; EBX <<= 16; EBX += yt + 5;
sys_write_text(EBX, tcolor, #tchar, 1);
EBX += 0x00010000;
sys_write_text(EBX, ECX, EDX, ESI);
NOCHAR:
sys_draw_line(xl << 16 + xl, yt << 16 + yb, clDarkGray);
sys_draw_line(xl << 16 + xr, yt << 16 + yt, EDX);
}
}
 
void draw_time()
// Òàéìåð
{
sys_draw_bar(XST<<16+25, 31<<16+10, 0xCCCCCC);
EBX = 0x00030000;
sys_write_number(EBX, time, XST<<16+32, 0x10ff0000);
}
 
void draw_minesi()
// Èíäèêàòîð êîëè÷åñòâà íåðàññòàâëåííûõ ìèí
{
EBX = xsize - XST - 25;
$PUSH EBX
EBX = EBX << 16 + 25;
sys_draw_bar(EBX, 31<<16+12, 0xCCCCCC);
$POP EDX
EDX <<= 16; EDX += 30;
EBX = 0x00030000;
sys_write_number(EBX, cmines, EDX, 0x10ff0000);
}
 
void draw_squares()
// Îòðèñîâêà ìèííîãî ïîëÿ
{
int x,y;
 
FOR (x=0; x < ncx; x++)
FOR (y=0; y < ncy; y++)
draw_square(x, y);
}
/programs/mine/trunk/mine.c--
0,0 → 1,468
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
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
 
*******************************************************************************/
 
//? pragma option LST // generate ASM listing file - ñîçäàòü àññåìáëåðíûé ëèñòèíã
//? warning TRUE // âêëþ÷èòü ðåæèì âûâîäà ïðåäóïðåæäåíèé
? pragma option meos
? jumptomain NONE
? include "msys.h--" // MenuetOS system functions - ñèñòåìíûå ôóíêöèè MenuetOS
 
? print "\nÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
? print "\n³ MeOS MineSweeper v0.3 ³"
? print "\n³ (C) Ivan Poddubny (ivan-yar@bk.ru) 2003 ³"
? print "\nÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n\n"
 
/************************************** DATA **************************************/
 
? define XPX 16 // X pixels by square - ðàçìåð êëåòêè â ïèêñåëÿõ
? define YPX 16 // Y pixels by square
? define MINE 255 // çíà÷åíèå äëÿ ìèíû â ïîëå value
 
struct
{
byte value; // number of mines - êîëè÷åñòâî ìèí â îêðóæàþùèõ êëåòêàõ
byte open; // square is open - êëåòêà îòêðûòà
byte press; // reserved - çàðåçåðâèðîâàíî
byte mark; // square is marked - êëåòêà ïîìå÷åíà
} massiv[30*30];
 
struct
{
byte a_inc;
byte b_inc;
} matrix[8] = {-1,-1,1,0,1,0,0,1,-2,0,0,1,1,0,1,0};
 
struct
{
byte x_size;
byte y_size;
byte nmines;
} stdmodes[3] = {9,9,10, 16,16,40, 30,16,99}; // {x,y,m}
 
int XST, // offset of first pixel X - ñìåùåíèå ïîëÿ îò ãðàíèöû îêíà
YST,
ncx, // number of squares in X - ðàçìåð ïîë
ncy,
cmines, // mines discovered - êîëè÷åñòâî íåîòêðûòûõ ìèí
initmines, // number of initial mines - èçíà÷àëüíîå êîëè÷åñòâî ìèí
sqclosed; // squares still closed - êîëè÷åñòâî çàêðûòûõ êëåòîê
 
dword xpos = 100, // window coordinates - êîîðäèíàòû îêíà
ypos = 100,
xsize, // window size
ysize;
 
byte stop_game = FALSE, // game stopped - ïðèçíàê êîíöà èãðû
mouse_en = TRUE, // mouse enabled - ìûøü
mode = 3, // ðåæèì èãðû 1-íîâè÷îê 2-ëþáèòåëü 3-ýêñïåðò (0 îñîáûé)
mouse_status,
firstmine;
 
ProcessInfo procinfo;
SystemColors colors;
 
/************************************** CODE **************************************/
 
inline void fastcall mouse_enable()
{
$mov eax,40
$mov ebx,100111b
$int 0x40
}
 
inline void fastcall mouse_disable()
{
$mov eax,40
$mov ebx,000111b
$int 0x40
}
 
? include "timer.h--" // timer functions
? include "draw.h--" // drawing functions
? include "access.h--" // get & set functions
? include "random.h--" // random number generator
//? include "uf.h--" // user field window
 
void init()
// Èíèöèàëèçàöè
{
XST = 10; YST = 52; // FIELD POSITION IN WINDOW
 
ECX = mode;
IF (ECX != 0)
{
//ncx = stdmodes[ECX-1].x_size;
//ncy = stdmodes[ECX-1].y_size;
//cmines = initmines = stdmodes[ECX-1].nmines;
 
EBX = #stdmodes;
ECX--; ECX *= 3;
EBX += ECX;
 
ncx = DSBYTE[EBX]; EBX++;
ncy = DSBYTE[EBX]; EBX++;
cmines = initmines = DSBYTE[EBX];
}
 
xsize = ncx * XPX + XST + XST;
ysize = ncy * YPX + YST + XST;
} // init
 
void clear_all()
// Î÷èñòèòü ïîëå
{
EAX = 0;
EDI = #massiv;
ECX = ncx * ncy;
$REP $STOSD
} // clear_all
 
void new_game()
// Íîâàÿ èãðà
{
init(); // èíèöèàëèçàöè
randomize(); // ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
clear_all(); // î÷èñòèòü ïîëå
 
firstmine = TRUE; // èãðà íå íà÷àòà
mouse_en = TRUE; // ìûøü ðàçðåøåíà
stop_game = FALSE; // èãðà íå çàêîí÷åíà
stop_timer();
time = 0; // âðåìÿ = 0
} // new_game
 
void set_mines(int nminas, no_x, no_y)
// Ðàññòàâèòü ìèíû
{
int i, x, y, a, b;
 
sqclosed = ncx * ncy - nminas; // êîëè÷åñòâî ÍÅîòêðûòûõ êëåòîê = ïëîùàäü ïîëÿ - êîë-âî ìèí
 
FOR (i = nminas; i > 0; i--) // ðàññòàâèòü ìèíû
{
x = random(ncx); y = random(ncy);
WHILE ((get_value(x, y) == MINE) || ((x == no_x) && (y == no_y)))
{
x = random(ncx);
y = random(ncy);
}
set_value(x, y, MINE);
}
 
for (x = ncx-1; x >= 0; x--) // ðàññòàâèòü öèôðû
{
for (y = ncy-1; y >= 0; y--)
{
IF (get_value(x, y) == MINE)
continue;
EDX = x * ncy + y*4 + #massiv;
a = x; b = y;
FOR (i = 0; i < 8; i++)
{
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (get_value(a, b) == MINE))
DSBYTE[EDX]++;
}
}
}
} // set_mines
 
inline void do_mouse(void)
// Îáðàáîò÷èê ìûøè
{
int x,y;
 
EAX = sys_read_mouse(2); // ìûøü íå íàæàòà -> âûõîä
IF (EAX == 0) return;
 
mouse_status = AL;
 
EAX = sys_read_mouse(1); // ìûøü âíå ïîëÿ -> âûõîä
EBX = EAX; EAX >>= 16; EBX &= 0xffff;
ECX = ncx * XPX + XST - 1;
EDX = ncy * YPX + YST - 1;
IF ((EAX < XST) || (EBX < YST) || (EAX > ECX) || (EBX > EDX)) return;
 
EAX -= XST; EAX /= XPX; x = EAX; // âû÷èñëèòü x è y
EBX -= YST; EBX /= YPX; y = EBX;
 
IF ((mouse_status == 1) && (!get_open(x, y)) && (get_mark(x, y) != 1))
{
// íà íåîòêðûòîé êëåòêå áåç ôëàæêà íàæàòà ëåâàÿ êíîïêà ìûøè
// left mouse button is pressed
IF (firstmine == TRUE)
{
firstmine = FALSE;
set_mines(cmines, x, y);
start_timer();
}
IF (get_value(x, y) == MINE)
{
end_game();
return;
}
open_square(x, y);
}
else IF ((mouse_status == 2) && (!get_open(x, y)))
{
// íà íåîòêðûòîé êëåòêå íàæàòà ïðàâàÿ êíîïêà ìûøè
// right mouse button is pressed
EBX = get_mark(x, y); EBX++;
EBX = EBX%3;
SWITCH (EBX)
{
CASE 2: cmines++; BREAK;
CASE 1: cmines--;
}
 
set_mark(x, y, EBX);
 
draw_minesi();
draw_square(x, y);
return;
}
ELSE IF ((mouse_status == 3) && (get_open(x, y)))
{
// íà îòêðûòîé êëåòêå íàæàòû îáå êíîïêè ìûøè
// both mouse buttons are pressed
IF (open_near_squares(x, y) == TRUE)
end_game();
}
 
if (sqclosed == 0)
// îòêðûòû âñå êëåòêè
// all squares are opened
{
mouse_en = FALSE; // çàïðåòèòü ìûøü
stop_timer();
stop_game = TRUE; // èãðà çàâåðøåíà
 
// ïîñòàâèòü íåðàññòàâëåííûå ìèíû
FOR (x = 0; x < ncx; x++)
FOR (y = 0; y < ncy; y++)
IF ((get_value(x, y) == MINE) && (get_mark(x, y) != 1))
{
set_mark(x, y, 1);
cmines--;
draw_square(x, y);
}
draw_minesi();
}
} // do_mouse
 
void open_square(int x, y)
// Îòêðûòü êëåòêó
{
int a, b, i;
 
set_open(x, y, TRUE);
sqclosed--;
 
IF (get_value(x, y) != 0)
{
draw_square(x, y);
}
else
{
draw_square(x, y);
a = x; b = y;
FOR (i = 0; i < 8; i++)
{
//a += matrix[i].a_inc;
//b += matrix[i].b_inc;
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (!get_open(a, b)) && (get_mark(a, b) != 1))
open_square(a, b);
}
}
} // open_square
 
int open_near_squares(int x, y)
// Îòêðûòü áëèçëåæàùèå êëåòêè (îáå êíîïêè ìûøè âìåñòå)
{
int a, b, i;
dword suma = 0;
 
a = x;
b = y;
FOR (i = 0; i < 8; i++)
{
//a+=matrix[i].a_inc;
//b+=matrix[i].b_inc;
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (get_mark(a, b) == 1))
suma++;
}
 
if (suma == get_value(x, y))
{
suma = 0;
a = x;
b = y;
for (i = 0; i < 8; i++)
{
//a+=matrix[i].a_inc;
//b+=matrix[i].b_inc;
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (!get_open(a, b)) && (get_mark(a, b) != 1))
{
IF (get_value(a, b) == MINE)
suma = 1;
open_square(a, b);
}
}
RETURN suma;
}
ELSE
RETURN 0;
} // open_near_squares
 
void end_game()
{
int x,y;
 
stop_game = TRUE;
stop_timer();
for (x=0; x<ncx; x++)
{
for (y=0; y<ncy; y++)
{
IF (get_value(x, y) == MINE)
{
set_mark(x, y, FALSE); // ñíÿòü ôëàã
open_square(x, y);
}
ELSE IF (get_mark(x, y) == 1) // åñëè ìèíû íåò, à ôëàæîê åñòü
{
EBX = XPX * x + XST; // x left
ECX = EBX + XPX - 1; // x right
EBX <<= 16; EBX += ECX;
$PUSH EBX
 
ECX = YPX * y + YST; // y top
$PUSH ECX
EDX = ECX + YPX - 1; // y bottom
ECX <<= 16; ECX += EDX;
sys_draw_line(EBX, ECX, clBlack);
 
$POP EDX
ECX = EDX + YPX - 1;
ECX <<= 16; ECX += EDX;
$POP EBX
sys_draw_line(EBX, ECX, clBlack);
CONTINUE;
}
}
}
} // end_game
 
 
void main()
{
sys_delay(5); // for old kernel only!
new_game();
draw_window();
 
mouse_enable();
while()
{
switch (sys_wait_event_timeout(100)) // wait for 1 second
{
CASE evReDraw:
draw_window();
continue;
 
CASE evKey:
IF (sys_get_key() == 27)
sys_exit_process();
continue;
 
CASE evButton:
EAX = sys_get_button_id();
IF (EAX == 911) // new game
{
new_game();
draw_squares();
draw_time();
draw_minesi();
}
ELSE IF (EAX == 1001) // change mode
{
// mode++; mode%=3; mode++;
EAX = mode; EAX++; EAX = EAX%3; EAX++; mode = AL;
 
// get window position - ïîëó÷èòü êîîðäèíàòû îêíà
sys_process_info(#procinfo, -1);
xpos = procinfo.xstart;
ypos = procinfo.ystart;
 
// start a new process and terminate this one
sys_create_thread(#main, ESP);
sys_exit_process();
}
//ELSE IF (EAX == 1002)
//{
// start_uf();
//}
ELSE IF (EAX == 1) // close window
sys_exit_process();
CONTINUE;
 
case evMouse:
IF (!mouse_en) // is mouse enabled ?
CONTINUE;
do_mouse();
// wait for mouse release - æäàòü îòïóñêàíèÿ êíîïêè
WHILE (sys_read_mouse(2) == mouse_status)
{
check_timer();
sys_delay(6);
CONTINUE;
}
check_timer();
IF (stop_game) // disable mouse if game is stopped
mouse_en = FALSE;
CONTINUE;
}
check_timer();
sys_delay(2);
}
} // main
/programs/mine/trunk/msys.h--
0,0 → 1,806
/*
Sphinx C-- header file for MenuetOS applications.
Based on msys.h-- written by Alexey Sugonyaev and modified by Barry Kauler.
This extended version is written by Ivan Poddubny.
 
e-mail: ivan-yar@bk.ru
*/
 
// KeyCode constant
#define UP_KEY 130+48
#define DOWN_KEY 129+48
#define LEFT_KEY 128+48
#define RIGHT_KEY 131+48
#define RETURN_KEY 13
#define BACKSPACE_KEY 8
 
// Color constant
#define clWhite 0x00ffffff
#define clGray 0x00808080
#define clLightGray 0x00c0c0c0
#define clDarkGray 0x00707070
#define clBlack 0x00000000
#define clRed 0x00ff0000
#define clGreen 0x0000ff00
#define clBlue 0x000000ff
 
#define evReDraw 1
#define evKey 2
#define evButton 3
#define evMouse 6
#define evIPC 7
 
struct FileInfo
{
dword read,
firstBlock,
qnBlockRead,
retPtr,
Work;
byte filedir;
};
 
struct ProcessInfo
{
dword cpu_usage;
word winstackpos;
word winstackval;
word not_used1;
byte name[12];
dword memstart,
memory_used,
PID,
xstart,
ystart,
xsize,
ysize;
byte not_used2[974];
};
 
#define SystemColors SystemColours // usa/british
 
struct SystemColours
{
dword w_frames,
w_grab,
w_grab_button,
w_grab_button_text,
w_grab_text,
w_work,
w_work_button,
w_work_button_text,
w_work_text,
w_work_graph;
};
 
/*
0 = DEFINE WINDOW
{x_start|y_start}, {x_size|y_size}, color_back, color_title, color_frames
EBX = [x_start][x_size]
ECX = [y_start][y_size]
EDX, ESI, EDI = [00RRGGBB]
*/
inline fastcall void sys_draw_window(dword EBX, ECX, EDX, ESI, EDI)
{
EAX = 0; // function 0 : define and draw window
$int 0x40
}
 
/*
01 = PUTPIXEL
ebx [x]
ecx [y]
edx pixel color 0x0XRRGGBB
^ 0 normal put, 1 negative
ret: nothing changed
*/
inline fastcall void sys_put_pixel(dword EBX,ECX,EDX)
{
EAX=1;
$int 0x40
}
 
/*
02 = GET KEY
ret: al 0 successful -> ah = key
al 1 no key in buffer
MODIFIED, see below...
*/
inline fastcall dword sys_get_key()
{
EAX = 2; // just read it key from buffer
$int 0x40
$shr eax,8
} //return eax=key code.
 
/*
03 = GET SYSTEM CLOCK
ret: eax 0x00SSMMHH sec,min,hour
*/
inline fastcall dword sys_get_clock()
{
EAX=3;
$int 0x40
}
 
/*
04 = WRITE TEXT TO WINDOW
ebx [x start]*65536 + [y start]
ecx text color 0x00RRGGBB
edx pointer to text beginning
esi text length
ret: nothing changed
*/
inline fastcall void sys_write_text(dword EBX, ECX, EDX, ESI)
{
EAX = 4;
$int 0x40;
}
 
/*
05 = DELAY X/100 SECS
ebx delay in 1/100 secs
ret: nothing changed
*/
inline fastcall void sys_delay(dword EBX)
{
EAX = 5;
$int 0x40
}
 
/*
06 = OPEN FILE FROM FLOPPY
ebx pointer to filename -> 11 capital letters
ecx set 0x00000000 - reserved
edx set 0xffffffff - reserved
esi read to mem position
ret: nothing changed
*/
inline fastcall void sys_open_file_floppy(dword EBX, ESI)
{
$xor ecx,ecx
EDX = -1;
EAX = 6;
$int 0x40
}
 
/*
07 = PUTIMAGE
ebx pointer to image in memory - RRGGBBRRGGBB..
ecx image size [x]*65536+[y]
edx image position in window [x]*65536+[y]
ret: eax 0 succesful, 1 overlapped
*/
inline fastcall dword sys_put_image(dword EBX, ECX, EDX)
{
EAX = 7;
$int 0x40
}
 
/*
08 = DEFINE BUTTON
ebx [x start]*65536 + [x size]
ecx [y start]*65536 + [y size]
edx button id number
esi button color 0x 00 RR GG BB
ret: nothing changed
*/
inline fastcall void sys_draw_button(dword EBX, ECX, EDX, ESI)
{
EAX = 8;
$int 0x40
}
 
/*
09 = PROCESS INFO
ebx pointer to 1024 bytes table
ecx process number or -1 = who am I
ret: eax number of processes
table : +00 dword cpu usage
+04 word processes position in windowing stack
+06 word window stack value at ecx
+10 12 db name of the process
+22 dword start of processes memory
+26 dword memory used by process
+30 dword PID of the process
+34 dword window x start
+38 dword window y start
+42 dword window x size
+46 dword window y size
*/
inline fastcall dword sys_process_info(dword EBX, ECX)
{
EAX = 9;
$int 0x40
}
 
/*
10 = WAIT FOR EVENT
ret: eax event type, 1 window redraw, 2 key in buffer, 3 button pressed
*/
inline fastcall dword sys_wait_event()
{
EAX = 10; // wait here for event
$int 0x40
}
 
/*
11 = CHECK FOR EVENT, NO WAIT
ret: eax 0 no event, 1 window redraw, 2 key in buffer, 3 button pressed
*/
inline fastcall dword sys_nowait_event()
{
EAX = 11;
$int 0x40
}
 
/* 12 = WINDOW REDRAW
EBX=1 start of draw, =2 end of draw.
*/
inline fastcall void sys_window_redraw(dword EBX)
{
EAX = 12; // function 12:tell os about windowdraw
$int 0x40
}
 
/*
13 = DRAW BAR
DrawBar(EBX=[xstart][xsize],ECX=[ystart][ysize],EDX=[0x00RRGGBB])
ebx [x start]*65536 + [x size]
ecx [y start]*65536 + [y size]
edx color 0x00RRGGBB
ret: nothing changed
*/
inline fastcall void sys_draw_bar(dword EBX, ECX, EDX)
{
EAX = 13;
$int 0x40
}
 
/*
14 = GET SCREEN MAX
ret: eax [screen x max]*65536 + [screen y max]
*/
inline fastcall dword sys_get_screen_size()
{
EAX = 14;
$int 0x40
}
 
/*
15 = BACKGROUND
ebx 1 : set background size
ecx x size
edx y size
ebx 2 : write to background memory - max (0x100000-16)
ecx position in memory in bytes
edx color 0x00RRGGBB
ebx 3 : draw background
ebx 4 : type of background draw
ecx 1 - tile
ecx 2 - stretch
ebx 5 : blockmove image to os bgr memory
ecx - from
edx - to where in os bgr memory
esi - count of bytes to move
*/
inline fastcall void sys_set_background(dword EBX, ECX, EDX, ESI)
{
EAX = 15;
$int 0x40
}
 
 
/*
17 = GET PRESSED BUTTON ID
ret: al 0 successful -> ah = id number al 1 no key in buffer.
MODIFIED, see below.
*/
inline fastcall dword sys_get_button_id()
{
EAX = 17; // Get ID
$int 0x40
$shr eax,8
} //eax=id, eax=0 no id.
 
/*
18 = SYSTEM SERVICE
ebx 1 - system boot
ebx 2 - force terminate , ecx process no
ebx 4 - idle clock cycles / second
ebx 5 - time stamp counter / second - cpu speed
HD-> ebx 6 - save ramdisk to /hd/1/menuet.img
*/
inline fastcall dword sys_service(dword EBX, ECX)
{
EAX = 18;
$int 0x40
}
 
/*
19 = START PROGRAM from RAMDISK
ebx point to 11 char filename
ecx 0, or point to ASCIIZ start parameters - max 256 bytes
ret: eax 0 successful
eax other error code
*/
inline fastcall dword sys_exec_app_ramdisk(dword EBX, ECX)
{
EAX = 19;
$int 0x40
}
 
/*
20 = MIDI INTERFACE - MPU401
ebx 1 - reset device
ebx 2 - cl midi data to output
*/
inline fastcall void sys_midi(dword EBX)
{
EAX = 20;
$int 0x40
}
 
/*
21 = SETUP FOR DEVICES
ebx 1=roland mpu midi base , base io address
ebx 2=keyboard 1 base keymap 2 shift keymap (ecx pointer to keymap)
9 country 1eng 2fi 3ger 4rus
ebx 3=cd base 1 pri.master 2 pri slave,
3 sec master 4 sec slave
ebx 4=sb16 base, base io address
ebx 5=system language, 1eng 2fi 3ger 4rus
ebx 6=wss base, base io address
ebx 7=hd base, 1 pri.master 2 pri slave
3 sec master 4 sec slave
ebx 8=fat32 partition in hd
*/
inline fastcall void sys_setup_devices(dword EBX, ECX)
{
EAX = 21;
$int 0x40
}
 
/*
23 = WAIT FOR EVENT WITH TIMEOUT
ebx time to delay in hs
ret: eax event type: 0 no event, 1 window redraw,
2 key in buffer, 3 button
*/
inline fastcall dword sys_wait_event_timeout(dword EBX)
{
EAX = 23;
$int 0x40
}
 
/*
24 = CD AUDIO
ebx 1 - play from ecx 00 FR SS MM
ebx 2 - get playlist size of ecx to [edx]
ebx 3 - stop/pause play
*/
inline fastcall void sys_cd_audio(dword EBX, ECX, EDX)
{
EAX = 24;
$int 0x40
}
 
/*
25 = SB16 - mixer I
ebx 1 - set main volume cl [L]*16+[R]
ebx 2 - set cd volume cl [L]*16+[R]
*/
inline fastcall void sys_sb16_mixer_1(dword EBX, ECX)
{
EAX = 25;
$int 0x40
}
 
/*
26 = GET SETUP FOR DEVICES
ebx 1=roland mpu midi base , base io address
ebx 2=keyboard 1 base keymap 2 shift keymap
9 country 1eng 2fi 3ger 4rus
ebx 3=cd base 1 pri.master 2 pri slave,
3 sec master 4 sec slave
ebx 4=sb16 base, base io address
ebx 5=system language, 1eng 2fi 3ger 4rus
ebx 6=wss base, base io address
ebx 7=hd base, 1 pri.master 2 pri slave
3 sec master 4 sec slave
ebx 8=fat32 partition in hd
ebx 9=1/100 timer tics from stard -> eax
return value in eax
*/
inline fastcall dword sys_get_setup_devices(dword EBX)
{
EAX = 26;
$int 0x40
}
 
/*
27 = WINDOWS SOUND SYSTEM
ebx 1 - set main volume to cl 0-255
ebx 2 - set cd volume to cl 0-255
*/
inline fastcall void sys_windows_sound_system(dword EBX, ECX)
{
EAX = 27;
$int 0x40
}
 
/*
28 = SB16 - mixer II
ebx 1 - set main volume to cl 0-255
ebx 2 - set cd volume to cl 0-255
*/
inline fastcall void sys_sb16_mixer_2(dword EBX, ECX)
{
EAX = 28;
$int 0x40
}
 
/*
29 = GET DATE
ret: eax 0x00YYDDMM year date month
*/
inline fastcall dword sys_get_date()
{
EAX = 29;
$int 0x40
}
 
/*
30 = READ HD
ebx pointer to file
ecx file lenght
edx block to read, starts from 1, blocksize = 512 bytes
esi reserved, set as 1
edi pointer to return/work area (atleast 20 000 bytes)
return: work_area+1024 <- requested block of 512 bytes
*/
inline fastcall dword sys_read_hd(dword EBX, ECX, EDX, ESI, EDI)
{
EAX = 30;
$int 0x40
}
 
/*
31 = START APP FROM HD
ebx pointer to file
ecx file lenght
edx pointer to return/work area (atleast 20 000 bytes)
ret eax=0 successful, eax<>0 errorcode
*/
inline fastcall dword sys_exec_app_hd()
{
EAX = 31;
$int 0x40
}
 
/*
32 = DELETE FILE FROM FLOPPY IMAGE IN MEMORY
ebx pointer to filename
*/
 
inline fastcall dword sys_floppy_delete(EBX)
{
EAX = 32;
$int 0x40
}
 
/*
33 = SAVE FILE TO FLOPPY IMAGE IN MEMORY
ebx pointer to file name
ecx pointer to data
edx count to write in bytes
esi 0 create new , ( 1 append - not implemented yet )
*/
inline fastcall dword sys_floppy_save(EBX,ECX,EDX)
{
EAX = 33;
ESI = 0;
$int 0x40
}
 
/*
34 = READ DIRECTORY FROM FLOPPY
ebx reserved : set as zero
ecx reserved : set as zero
edx start 512 block to read
esi reserved : set as 1
edi pointer to return area
 
 
35 = READ SCREEN PIXEL
ebx = pixel count from top left of the screen
return : eax = 0x00RRGGBB
*/
 
/*
37 = READ MOUSE POSITION
ebx=0 screen relative
ebx=1 window relative
ebx=2 buttons pressed
return in eax
*/
inline fastcall dword sys_read_mouse(dword EBX)
{
EAX = 37;
$int 0x40
}
 
/*
38 = DRAW LINE
ebx [x start] shl 16 + [x end]
ecx [y start] shl 16 + [y end]
edx colour 0x00RRGGBB
return : nothing changed
*/
inline fastcall void sys_draw_line(dword EBX, ECX, EDX)
{
EAX = 38;
$int 0x40
}
 
/*
39 = GET BACKGROUND
ebx=1 -> eax=[bgr x size] shl 16 + [bgr y size]
ebx=2
ecx= postition of backgrounds memorymap to return in eax
ebx=4 -> eax=1 tiled, eax=2 stretched
*/
inline fastcall dword sys_get_background(dword EBX, ECX)
{
EAX = 39;
$int 0x40
}
 
/*
40 = SET BITFIELD FOR WANTED EVENTS
as default:
ebx = 00000000 00000000 00000000 00000111b events:
I window draw
I key in buffer
I button in buffer
I (end request)
I desktop background draw
I (mouse change)
I---------------I get irqs data
 
 
41 = GET IRQ OWNER
ebx = irq
return : PID of the process
 
 
42 = GET DATA READ BY IRQ
ebx IRQ number
return : eax number of bytes in buffer
bl data
ecx 0 = successful data read
1 = no data in buffer
2 = incorrect IRQ owner
 
 
43 = SEND DATA TO DEVICE
bx : port
cl : data
return : eax = if 0 successful, other = error
 
 
44 = PROGRAM IRQ's
ebx pointer to table
ecx irq number
 
 
45 = RESERVE/FREE IRQ
ebx 0 reserve 1 free
ecx IRQ number
ret eax 0 successful, 1 error
 
 
46 = RESERVE/FREE PORT AREA
ebx 0 reserve 1 free
ecx port area start
edx port area end
ret eax 0 successful, 1 error
*/
 
/*
47 = DISPLAY NUMBER TO WINDOW
ebx = print type, bl=0 -> ecx is number
bl=1 -> ecx is pointer
bh=0 -> display decimal
bh=1 -> display hexadecimal
bh=2 -> display binary
bits 16-21 = number of digits to display (0-32)
bits 22-31 = reserved
ecx = number or pointer
edx = x shl 16 + y
esi = color
*/
inline fastcall void sys_write_number(dword EBX, ECX, EDX, ESI)
{
EAX = 47;
$int 0x40
}
 
/*
48 = DEFINE GENERAL WINDOW PROPERTIES
ebx = 0 apply/redraw
ecx = 0 , apply/redraw desktop
ebx = 1 define button style
ecx = 0 , set flat buttons
ecx = 1 , set 3d buttons
ebx = 2 define window colors
ecx = pointer to table
edx = number of bytes defined
ebx = 3 get define window colors
ecx = pointer to table
edx = number of bytes to get
*/
 
inline fastcall void sys_redraw_desktop()
{
EAX = 48;
EBX = ECX = 0;
$int 0x40
}
 
inline fastcall void sys_set_button_style(dword ECX)
{
EAX = 48;
EBX = 1;
$int 0x40
}
 
inline fastcall void sys_set_colors(dword ECX,EDX)
{
EAX = 48;
EBX = 2;
$int 0x40
}
 
inline fastcall void sys_get_colors(dword ECX,EDX)
{
EAX = 48;
EBX = 3;
$int 0x40
}
 
/*
49 = DEFINE APPLICATIONS INTERNAL INTERRUPTS
ebx = 0
ecx point to dword x 256 table of interrupt entries
inside the application
return : nothing changed
 
 
50 = FREE FORM WINDOW SHAPE AND SCALE
ebx = 0 ; shape reference area
ecx = pointer to reference area
byte per pixel, 0 not used, 1=used, other = reserved
ebx = 1 ; scale of reference area (default 1:1)
ecx : scale is set to 2^ecx
return: nothing changed
 
 
51 = CREATE THREAD
ebx = 1 ; create
ecx ; = thread entry point
edx ; = thread stack position
return : eax = pid or 0xfffffff0+ for error
*/
 
inline fastcall dword sys_create_thread(dword ECX,EDX)
{
EAX = 51;
EBX = 1;
$int 0x40
}
 
/*
 
52 = STACK DRIVER STATUS
- see stack.txt
 
 
53 = SOCKET INTERFACE
- see stack.txt
 
 
54 = USER EVENTS
- not ready yet
 
 
55 = SOUND INTERFACE
ebx = 0 ; load 44 khz 8 bit mono sound block
ecx ; = pointer to 65536 byte soundblock
ebx = 1 ; play 44 khz 8 bit mono sound block
 
 
56 = WRITE FILE TO HD
ebx pointer to 12 char filename
ecx bytes to write
edx pointer to data to write
esi pointer to path
path db 0
 
 
57 = DELETE FILE FROM HD
ebx pointer to filename : 11 capital letters
edx pointer to path : path db 0
*/
 
 
/*
58 = SYSTEM TREE ACCESS
ebx pointer to fileinfo block
fileinfo:
dd 0x0 ; 0=read (/write/delete/append)
dd 0x0 ; 512 block to read 0+
dd 0x1 ; blocks to read (/bytes to write/append)
dd 0x20000 ; return data pointer
dd 0x10000 ; work area for os - 16384 bytes
db '/RAMDISK/FIRST/KERNEL.ASM',0 ; ASCIIZ dir & filename
*/
inline fastcall void sys_tree_access(dword EBX)
{
EAX = 58;
$int 0x40
}
 
/*
59 = TRACE FOR SYSTEM CALLS FROM PROCESSES
ebx = 0 ; get system events
ecx ; pointer to table -> ; 64 bytes/system call descriptor
; +00 PID
; +32 EDI
; +36 ESI
; +40 EBP
; +44 ESP
; +48 EBX
; +52 EDX
; +56 ECX
; +60 EAX
edx ; number of bytes to return to table (currently max 16*64)
return: eax = number of system calls from start
latest call is saved to (eax mod 16)*64 in table
ebx = 0 : above format
*/
 
/*
60 = IPC
ebx = 1 ; define receive area
ecx = pointer to start
edx = size of area
 
ebx = 2 ; send message
ecx = PID
edx = pointer to message
esi = length
*/
 
inline fastcall void sys_ipc_init(dword ECX, EDX)
{
EAX = 60;
EBX = 1;
$int 0x40
}
 
inline fastcall void sys_ipc_send(dword ECX, EDX, ESI)
{
EAX = 60;
EBX = 2;
$int 0x40
}
 
/* -1 = EXIT PROCESS */
 
inline fastcall void sys_exit_process()
{
$xor eax,eax
$dec eax
$int 0x40
}
/programs/mine/trunk/random.h--
0,0 → 1,52
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
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
 
*******************************************************************************/
 
dword generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
 
:int random(int max)
// get pseudo-random number - ïîëó÷èòü ïñåâäîñëó÷àéíîå ÷èñëî
{
$rdtsc // eax & edx
$xor eax,edx
$not eax
 
EBX = generator;
$ror ebx,3
$xor ebx,0xdeadbeef
EBX += EAX;
generator = EBX;
EAX += EBX;
EAX = EAX % max;
return EAX;
}
 
:randomize()
// initialize random number generator - èíèöèàëèçèðîâàòü ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
{
asm
{
mov eax,3
int 0x40
ror eax,16
}
generator = EAX;
}
/programs/mine/trunk/timer.h--
0,0 → 1,52
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
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
 
*******************************************************************************/
 
dword time,
ttime;
 
byte timer_life;
 
start_timer()
{
timer_life = TRUE;
ttime = sys_get_clock();
}
 
stop_timer()
{
timer_life = FALSE;
}
 
check_timer()
{
IF (!timer_life) return;
 
EAX = sys_get_clock();
IF (EAX == 0xffffff) return;
IF (ttime != EAX)
{
ttime = EAX;
IF (time < 999)
time++;
draw_time();
}
}
/programs/mine/trunk/uf.h--
0,0 → 1,135
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
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
 
*******************************************************************************/
 
// USER FIELD WINDOW
 
byte px,py,pm;
 
byte uf_open = FALSE;
byte uf_stack[2048];
 
byte str1[5];
byte str2[5];
byte str3[5];
 
dword uf_x,
uf_y;
 
void draw_uf_window()
{
sys_get_colors(#colors, 40);
sys_window_redraw(1);
 
EDX = colors.w_work;
$bts edx,25
sys_draw_window(uf_x, uf_y, EDX, colors.w_grab | 0x80000000, colors.w_frames);
ECX = colors.w_grab_text | 0x10000000;
sys_write_text(8<<16+8, colors.w_grab_text | 0x10000000, "USER FIELD", 10);
sys_draw_button(81<<16+12, 5<<16+12, 1, colors.w_grab_button);
 
ECX = colors.w_work_text | 0x10000000;
sys_write_text(8<<16+31, ECX, "WIDTH", 5);
sys_write_text(8<<16+49, ECX, "HEIGHT", 6);
sys_write_text(8<<16+67, ECX, "MINES", 5);
 
// three buttons:
// 1) WIDTH 10
// 2) HEIGHT 11
// 3) MINES 12
// and also:
// OK, Cancel - 20,21
 
sys_draw_button(54<<16+38, 30<<16+10, 10, 0xe0e0e0); // WIDTH
EDX++; sys_draw_button(EBX, 48<<16+10, EDX, ESI); // HEIGHT
EDX++; sys_draw_button(EBX, 66<<16+10, EDX, ESI); // MINES
 
ESI = colors.w_work_button;
ECX = 84<<16+10;
sys_draw_button( 8<<16+38, ECX, 20, ESI); EDX++;
sys_draw_button(54<<16+38, ECX, EDX, ESI);
 
sys_write_text(21<<16+85, colors.w_work_button_text, "OK Cancel", 12);
 
sys_window_redraw(2);
}
 
void uf_main()
{
uf_x <<= 16; uf_x += 100;
uf_y <<= 16; uf_y += 104;
draw_uf_window();
 
WHILE()
{
SWITCH (sys_wait_event())
{
case 1: draw_uf_window();
break;
 
case 2: IF (sys_get_key() == 27)
{
uf_open = FALSE;
sys_exit_process();
}
break;
 
case 3: uf_button();
}
}
}
 
uf_button()
{
switch (sys_get_button_id())
{
//case 10:
//case 11:
//case 12:
 
case 20:
case 21:
 
case 1:
uf_open = FALSE;
sys_exit_process();
}
}
 
void start_uf()
{
sys_process_info(#procinfo, -1);
uf_x = procinfo.xstart + XST;
uf_y = procinfo.ystart + YST;
 
sys_create_thread(#uf_main, #uf_stack + 2048);
uf_open = TRUE;
mouse_disable();
WHILE (uf_open == TRUE)
{
SWITCH (sys_wait_event_timeout(5))
{
CASE 1: draw_window(); CONTINUE;
CASE 2: sys_get_key(); CONTINUE;
CASE 3: sys_get_button_id(); CONTINUE;
}
}
mouse_enable();
}
/programs/mixer/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mixer.asm mixer
@pause
/programs/mixer/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mixer.asm mixer
@pause
/programs/mixer/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mixer/trunk/mixer.asm
0,0 → 1,491
 
;
; MIXER
;
; 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: ; start of execution
 
 
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
int 0x40
 
cmp ah,1 ; button id=1 ?
jnz noclose
mov eax,-1 ; close this program
int 0x40
noclose:
 
cmp ah,101
jnz nochange
mov al,byte [usecard]
cld
inc al
and al,3
cmp al,0
jnz nozer
mov al,1
nozer:
mov byte [usecard],al
 
call drawusedcard
 
nochange:
 
cmp byte [usecard],byte 1
jz usesb16
 
cmp byte [usecard],byte 2
jnz nousesb16II
jmp usesb16II
nousesb16II:
 
cmp byte [usecard],byte 3
jnz nousewss
jmp usewss
nousewss:
 
 
 
; SOUND BLASTER 16
 
 
usesb16:
 
 
cld
 
mov al,20
cmp ah,al
jge nomain
 
mov ecx,0
cmp ah,12
jnz nomain12
mov ecx,3*16+3
nomain12:
cmp ah,13
jnz nomain13
mov ecx,7*16+7
nomain13:
cmp ah,14
jnz nomain14
mov ecx,11*16+11
nomain14:
cmp ah,15
jnz nomain15
mov ecx,15*16+15
nomain15:
 
mov eax,25
mov ebx,1
int 0x40
 
jmp still
 
nomain:
 
mov al,30
cmp ah,al
jge nocd
 
mov ecx,0
 
cmp ah,22
jnz nocd12
mov ecx,3*16+3
nocd12:
cmp ah,23
jnz nocd13
mov ecx,7*16+7
nocd13:
cmp ah,24
jnz nocd14
mov ecx,11*16+11
nocd14:
cmp ah,25
jnz nocd15
mov ecx,15*16+15
nocd15:
 
mov eax,25
mov ebx,2
int 0x40
 
jmp still
 
nocd:
 
 
jmp still
 
 
 
 
; SOUND BLASTER 16 II
 
usesb16II:
 
cld
 
mov al,20
cmp ah,al
jge IIwnomain
 
mov ecx,0
cmp ah,12
jnz IIwnomain12
mov ecx,50
IIwnomain12:
cmp ah,13
jnz IIwnomain13
mov ecx,150
IIwnomain13:
cmp ah,14
jnz IIwnomain14
mov ecx,200
IIwnomain14:
cmp ah,15
jnz IIwnomain15
mov ecx,255
IIwnomain15:
 
mov eax,28
mov ebx,1
int 0x40
 
jmp still
 
IIwnomain:
 
mov al,30
cmp ah,al
jge IIwnocd
 
mov ecx,0
 
cmp ah,22
jnz IIwnocd12
mov ecx,50
IIwnocd12:
cmp ah,23
jnz IIwnocd13
mov ecx,150
IIwnocd13:
cmp ah,24
jnz IIwnocd14
mov ecx,200
IIwnocd14:
cmp ah,25
jnz IIwnocd15
mov ecx,255
IIwnocd15:
 
mov eax,28
mov ebx,2
int 0x40
 
jmp still
 
IIwnocd:
 
 
jmp still
 
 
 
 
 
 
 
 
 
; WINDOWS SOUND SYSTEM
 
usewss:
 
cld
 
mov al,20
cmp ah,al
jge wnomain
 
mov ecx,255
cmp ah,12
jnz wnomain12
mov ecx,200
wnomain12:
cmp ah,13
jnz wnomain13
mov ecx,150
wnomain13:
cmp ah,14
jnz wnomain14
mov ecx,70
wnomain14:
cmp ah,15
jnz wnomain15
mov ecx,0
wnomain15:
 
mov eax,27
mov ebx,1
int 0x40
 
jmp still
 
wnomain:
 
mov al,30
cmp ah,al
jge wnocd
 
mov ecx,255
 
cmp ah,22
jnz wnocd12
mov ecx,200
wnocd12:
cmp ah,23
jnz wnocd13
mov ecx,150
wnocd13:
cmp ah,24
jnz wnocd14
mov ecx,70
wnocd14:
cmp ah,25
jnz wnocd15
mov ecx,0
wnocd15:
 
mov eax,27
mov ebx,2
int 0x40
 
jmp still
 
wnocd:
 
 
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+195 ; [x start] *65536 + [x size]
mov ecx,100*65536+140 ; [y start] *65536 + [y size]
mov edx,[wcolor] ; color of work area RRGGBB
mov 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,0x00ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(195-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,0x22aacc ; button color RRGGBB
; int 0x40
 
mov edx,16 ; button id
mov ebx,10*65536
 
newbut:
 
push edx
push ebx
 
mov esi,[bcolor]
 
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,35*65536+8 ; [y start] *65536 + [y size]
dec edx
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,45*65536+8 ; [y start] *65536 + [y size]
dec edx
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,55*65536+8 ; [y start] *65536 + [y size]
dec edx
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,65*65536+8 ; [y start] *65536 + [y size]
dec edx
int 0x40
mov eax,8 ; function 8 : define and draw button
mov bx,22 ; [x start] *65536 + [x size]
mov ecx,75*65536+8 ; [y start] *65536 + [y size]
dec edx
int 0x40
 
pop ebx
pop edx
 
add ebx,30*65536
add edx,10
 
cmp edx,16+6*10
jz butdone
 
jmp newbut
 
butdone:
 
 
mov eax,4 ; function 4 : write text to window
mov ebx,10*65536+104 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,text ; pointer to text beginning
mov esi,29
int 0x40
 
mov eax,8 ; function 8 : define and draw button
mov ebx,(5)*65536+185 ; [x start] *65536 + [x size]
mov ecx,120*65536+14 ; [y start] *65536 + [y size]
mov edx,101 ; button id
mov esi,[bcolor] ; button color RRGGBB
int 0x40
 
call drawusedcard
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
drawusedcard:
 
pusha
 
mov eax,13
mov ebx,14*65536+160
mov ecx,123*65536+10
mov edx,[bcolor]
int 0x40
 
mov eax,[usecard]
mov edx,c3
 
cmp al,1
jnz nosbc
mov edx,c1
nosbc:
cmp al,2
jnz nosbcII
mov edx,c2
nosbcII:
cmp al,3
jnz nowssc
mov edx,c3
nowssc:
 
mov eax,4
mov ebx,14*65536+123
mov ecx,0x00ffffff
mov esi,30
int 0x40
 
popa
 
ret
 
 
 
; DATA AREA
 
bcolor dd 0x5577c8
 
wcolor dd 0x03000000
 
 
text:
db 'MAIN CD WAVE MPU4 AUX1 AUX2'
 
c1 db 'SOUND BLASTER 16 - MIXER I '
c2 db 'SOUND BLASTER 16 - MIXER II '
c3 db 'WINDOWS SOUND SYSTEM '
 
 
usecard dd 0x1
 
labelt:
db 'MIXER'
labellen:
 
I_END:
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/movback/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm movback.asm movback
@pause
/programs/movback/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm movback.asm movback
@pause
/programs/movback/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/movback/trunk/movback.asm
0,0 → 1,188
include "lang.inc"
include "macros.inc"
 
WND_SIZE_X = 320
WND_SIZE_Y = 200
 
VC_DELTA = 1
HC_DELTA = 2
 
MEOS_APP_START
CODE
fninit
call init_sinus_table
call init_background
call init_palette
mov eax,40
mov ebx,101b
int 0x40
jmp .paint_window
 
.event_loop:
mov eax,23
mov ebx,1
int 0x40
 
test eax,eax
je .draw_screen
dec eax
je .paint_window
 
or eax,-1
int 0x40
 
.draw_screen:
add word [ver_counter],VC_DELTA
add word [hor_counter],HC_DELTA
call handle_animation
mov eax,7
mov ebx,virtual_screen_32
mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y
mov edx,(5 shl 16)+23
int 0x40
jmp .event_loop
 
.paint_window:
mov eax,12
mov ebx,1
int 0x40
 
xor eax,eax
mov ebx,(100 shl 16)+(WND_SIZE_X+9)
mov ecx,(100 shl 16)+(WND_SIZE_Y+28)
mov edx,0x03000000
int 0x40
 
mov eax,7
mov ebx,virtual_screen_32
mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y
mov edx,(5 shl 16)+23
int 0x40
 
mov eax,4
mov ebx,0x00060006
mov ecx,0x10ffffff
mov edx,window_title
mov esi,window_title_len
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
jmp .event_loop
 
init_palette:
mov ecx,256
mov edi,_palette
xor eax,eax
.next_pal:
mov al,ah
shr al,2
stosb
stosb
stosb
inc edi
inc ah
loop .next_pal
ret
 
init_sinus_table:
sub esp,4
mov ecx,256
mov edi,sinetable
.sin_loop:
fld dword [esp]
fld st0
fsin
fmul [scale_sin]
fistp word [edi]
fadd [delta_angle]
fstp dword [esp]
add edi,2
loop .sin_loop
add esp,4
ret
 
init_background:
mov edi,background
xor edx,edx
.ib_vertical:
xor ecx,ecx
.ib_horizontal:
mov eax,ecx
xor eax,edx
stosb
inc ecx
cmp ecx,256
jne .ib_horizontal
inc edx
cmp edx,256
jne .ib_vertical
ret
 
s_OFFX = 0
s_OFFY = 2
 
handle_animation:
sub esp,4
mov ebx,[ver_counter]
and ebx,255
add ebx,ebx
mov ax,[sinetable+ebx]
mov [esp+s_OFFY],ax
mov ebx,[hor_counter]
and ebx,255
add ebx,ebx
mov ax,[sinetable+ebx]
mov [esp+s_OFFX],ax
mov edi,virtual_screen_32
mov edx,WND_SIZE_Y-1
.a_ver:
mov ecx,WND_SIZE_X-1
mov bx,[esp+s_OFFY]
add bx,dx
and ebx,255
shl ebx,8
.a_hor:
mov ax,[esp+s_OFFX]
add ax,cx
and eax,255
lea esi,[background+ebx+eax]
mov al,[esi]
and eax,0xff
mov eax,[_palette+eax*4]
stosw
shr eax,16
stosb
dec ecx
jge .a_hor
dec edx
jge .a_ver
add esp,4
ret
 
DATA
delta_angle dd 0.0245436926066 ; pi/128
scale_sin dd 128.0
 
window_title:
db 'MoveBack'
window_title_len = $ - window_title
 
UDATA
ver_counter dd ?
hor_counter dd ?
 
_palette: rd 256
 
virtual_screen_32:
rb WND_SIZE_X*WND_SIZE_Y*3
 
background:
rb 256*256
 
sinetable:
rw 256
 
MEOS_APP_END
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mp3s/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mp3s.asm mp3s
@pause
/programs/mp3s/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mp3s.asm mp3s
@pause
/programs/mp3s/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mp3s/trunk/mp3s.asm
0,0 → 1,791
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Tiny MP3 Shoutcast Server v0.1 (vt) ;
; ;
; Compile with FASM for Menuet ;
; ;
; Listening to port 8008 ;
; Connect with eg: 192.168.1.22:8008 ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
version equ '0.3'
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; program start
dd I_END ; program image size
dd 0x80000 ; memory usage
dd 0x20000 ; stack
dd 0,0
 
include 'lang.inc'
include 'macros.inc'
 
; 0x0+ program image
; 0x1ffff stack
; 0x20000 work area for file read
; 0x40000+ file send buffer ( 100 kb )
 
 
START: ; start of execution
 
mov [status],0
call clear_input
call draw_window ; at first, draw the window
 
still:
 
mov eax,23 ; wait here for event
mov ebx,2
int 0x40
 
call check_events
 
call check_connection_status
 
cmp [status],4
je start_transmission
 
jmp still
 
 
check_events:
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
 
ret
 
red: ; redraw
call draw_window
ret
 
key:
mov eax,2 ; Just read it and ignore
int 0x40
ret
 
button: ; button
 
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; close
jne no_close
mov eax,-1
int 0x40
no_close:
 
cmp ah,2 ; button id=2 ?
jnz tst3
; open socket
mov eax,53
mov ebx,5
mov ecx,8008 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
mov [posy],1
mov [posx],0
mov [read_on],1
call check_for_incoming_data
call draw_window
ret
tst3:
 
cmp ah,4
je close_socket
cmp ah,6
je close_socket
jmp no_socket_close
close_socket:
mov edx,eax
; Close socket
mov eax, 53
mov ebx, 8
mov ecx, [socket]
int 0x40
mov esp,0x1fff0
cmp dh,6
je read_string
jmp still
no_socket_close:
 
cmp ah,9
jne no_bps_add
add [bps],8*1000
call draw_window
ret
no_bps_add:
 
cmp ah,8
jne no_bps_sub
sub [bps],8*1000
call draw_window
ret
no_bps_sub:
 
 
ret
 
 
clear_input:
 
mov edi,input_text
mov eax,0
mov ecx,60*40
cld
rep stosb
 
ret
 
 
read_string:
 
mov [addr],dword filename
mov [ya],dword 95
 
mov edi,[addr]
mov eax,32
mov ecx,30
cld
rep stosb
 
call print_text
 
mov edi,[addr]
 
f11:
mov eax,10
int 0x40
cmp eax,2
jne read_done
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je read_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
sub edi,1
mov [edi],byte 32
call print_text
jmp f11
nobsl:
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
sub eax,32
keyok:
mov [edi],al
 
call print_text
 
add edi,1
mov esi,[addr]
add esi,30
cmp esi,edi
jnz f11
 
read_done:
 
mov ecx,40
mov eax,0
cld
rep movsb
 
call print_text
 
jmp still
 
 
print_text:
 
pusha
 
mov eax,13
mov ebx,56*65536+30*6
mov ecx,[ya]
shl ecx,16
mov cx,8
mov edx,0xffffff
int 0x40
 
mov eax,4
mov edx,[addr]
mov ebx,56*65536
add ebx,[ya]
mov ecx,0x000000
mov esi,30
int 0x40
 
popa
ret
 
 
wait_for dd 0x0
 
transmission_start dd 0x0
sentbytes dd 0x0
 
start_transmission:
 
call clear_input
 
mov eax,5
mov ebx,50
int 0x40
 
call check_for_incoming_data
call draw_window
 
call send_header
 
mov [fileinfo+4],dword 0 ; start from beginning
mov [read_to],0x40000
mov [playpos],0x40000
 
mov ecx,1024 / 512
 
new_buffer:
 
mov eax,[read_to]
mov ebx,1
call read_file
 
loop new_buffer
 
 
newpart:
 
call check_connection_status
call draw_window
 
mov eax,26
mov ebx,9
int 0x40
mov [transmission_start],eax
mov [sentbytes],0
 
newblock:
 
mov eax,[read_to]
mov ebx,2
call read_file
 
wait_more:
 
mov eax,26
mov ebx,9
int 0x40
 
cmp eax,[wait_for]
jge nomw
 
mov eax,5
mov ebx,1
int 0x40
 
jmp wait_more
 
nomw:
 
add eax,2
mov [wait_for],eax
 
mov eax,11
int 0x40
call check_events
 
mov eax,53
mov ebx,255
mov ecx,103
int 0x40
 
cmp eax,0
jne wait_more
 
; write to socket
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,[playadd]
mov esi,[playpos]
int 0x40
 
add [sentbytes],edx
 
mov esi,[playpos]
add esi,[playadd]
mov edi,0x40000
mov ecx,110000 / 4
cld
rep movsd
 
mov eax,[playadd]
sub [read_to],eax
 
call check_for_incoming_data
call show_progress
call check_rate
 
mov eax, 53
mov ebx, 6
mov ecx, [socket]
int 0x40
cmp eax,4
jne end_stream
 
cmp [read_to],0x40000
jge newblock
 
end_stream:
 
; Close socket
 
mov eax, 53
mov ebx, 8
mov ecx, [socket]
int 0x40
 
mov eax,5
mov ebx,5
int 0x40
 
; Open socket
 
mov eax,53
mov ebx,5
mov ecx,8008 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
mov [posy],1
mov [posx],0
mov [read_on],0
 
call draw_window
 
jmp still
 
 
check_rate:
 
pusha
 
mov eax,[bps]
xor edx,edx
mov ebx,8*100
div ebx
shl eax,1
mov [playadd],eax
 
mov eax,26
mov ebx,9
int 0x40
 
sub eax,[transmission_start]
shr eax,1
 
imul eax,[playadd]
 
mov edx,0x00dd00
 
cmp [sentbytes],eax
jge sendok
 
sub eax,20000
cmp [sentbytes],eax ; a long buffer underrun correction
jge no_buffer_overrun ; actually leads to overrun
mov [sentbytes],eax
no_buffer_overrun:
 
add [playadd],150
mov edx,0xdd0000
 
sendok:
 
mov eax,13
mov ebx,320*65536+10
mov ecx,105*65536+10
int 0x40
 
mov eax,47
mov ebx,4*65536
mov ecx,[playadd]
mov edx,322*65536+106
mov esi,0x000000
; int 0x40
 
popa
 
ret
 
 
show_progress:
 
pusha
 
mov eax,13
mov ebx,236*65536+10*6
mov ecx,107*65536+8
mov edx,0xffffff
int 0x40
 
mov ecx,[fileinfo+4]
imul ecx,512
 
mov eax,47 ; file read
mov ebx,9*65536
mov edx,236*65536+107
mov esi,0x000000
int 0x40
 
popa
ret
 
 
playpos dd 0x100000
playadd dd 256000 / 8 / 100
 
 
send_header:
 
pusha
 
mov [playpos],0x40000
 
mov esi,fileinfo+5*4
mov edi,transname
mov ecx,30
cld
rep movsb
 
mov eax, 53
mov ebx, 7
mov ecx, [socket]
mov edx, headere-headers
mov esi, headers
int 0x40
 
popa
ret
 
 
read_file:
 
cmp [read_to],0x40000+2000
jg cache_ok
mov [read_on],1
cache_ok:
 
cmp [read_to],0x40000+95500
jg no_read_1
 
mov [fileinfo+12],eax
mov [fileinfo+8],ebx
 
mov eax,58
mov ebx,fileinfo
int 0x40
 
cmp eax,0
jne no_read_1
 
mov eax,[fileinfo+8]
add [fileinfo+4],eax
 
add [read_to],512*2
 
ret
 
no_read_1:
 
mov [read_on],0
 
ret
 
 
 
check_for_incoming_data:
 
pusha
 
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
 
cmp eax,0
je _ret_now
 
new_data:
 
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
 
cmp eax,0
je _ret
 
mov eax,53
mov ebx,3
mov ecx,[socket]
int 0x40
 
cmp bl,10
jne no_lf
inc [posy]
mov [posx],0
jmp new_data
no_lf:
 
cmp bl,20
jb new_data
 
inc [posx]
cmp [posx],60
jbe xok
inc [posy]
mov [posx],0
xok:
 
cmp [posy],12
jbe yok
mov [posy],1
yok:
 
mov eax,[posy]
imul eax,60
add eax,[posx]
 
mov [input_text+eax],bl
 
jmp new_data
 
_ret:
 
; call draw_window
 
_ret_now:
 
popa
ret
 
 
 
check_connection_status:
 
pusha
 
mov eax, 53
mov ebx, 6
mov ecx, [socket]
int 0x40
 
cmp eax,[status]
je .ccs_ret
mov [status],eax
add eax,48
mov [text+20],al
call draw_window
.ccs_ret:
 
popa
ret
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
pusha
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
mov eax,0 ; Draw Window
mov ebx,50*65536+410
mov ecx,100*65536+141
mov edx,0x03ffffff
mov esi,0x00405080
mov edi,0x00405080
int 0x40
 
mov eax,4 ; Window label
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,wls
mov esi,wle-wls
int 0x40
 
mov eax,8 ; Start server
mov ebx,(25)*65536+21
mov ecx,57*65536+10
mov edx,2
mov esi,0x409040
int 0x40 ; Stop server
mov eax,8
mov ebx,(25)*65536+21
mov ecx,69*65536+10
mov edx,4
mov esi,0x904040
int 0x40
 
mov esi,0x3366d0
 
mov eax,8 ; Enter filename
mov ebx,(25)*65536+21
mov ecx,93*65536+10
mov edx,6
int 0x40
mov eax,8 ; Decrease transfer rate
mov ebx,(25)*65536+10
mov ecx,105*65536+10
mov edx,8
int 0x40
mov eax,8 ; Increase transfer rate
mov ebx,(36)*65536+10
mov ecx,105*65536+10
mov edx,9
int 0x40
 
mov ebx,10*65536+35 ; draw info text
mov ecx,0x00000000
mov edx,text
mov esi,40
newline:
mov eax,4
int 0x40
add ebx,12
add edx,40
cmp [edx],byte 'x'
jnz newline
 
mov eax,4 ; Filename
mov ebx,56*65536+95
mov ecx,0x000000
mov edx,filename
mov esi,30
int 0x40
 
mov eax,[bps]
xor edx,edx
mov ebx,1000
div ebx
mov ecx,eax
 
mov eax,47
mov ebx,3*65536
mov edx,58*65536+107
mov esi,0x00000000
int 0x40
 
mov [input_text+0],dword 'RECE'
mov [input_text+4],dword 'IVED'
mov [input_text+8],dword ': '
 
mov ebx,230*65536+35 ; draw info text
mov ecx,0x00000000
mov edx,input_text
mov esi,28
mov edi,7
newline2:
mov eax,4
int 0x40
add ebx,10
add edx,60
dec edi
jnz newline2
 
mov eax,38
mov ebx,210*65536+210
mov ecx,22*65536+136
mov edx,0x6699cc ; 002288
int 0x40
 
mov eax,38
mov ebx,211*65536+211
mov ecx,22*65536+136
mov edx,0x336699 ; 002288
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
popa
 
ret
 
 
 
; DATA AREA
 
text:
db ' TCB status: 0 '
db ' '
db ' Activate - port 8008 '
db ' Stop server '
db ' '
db ' > '
db ' < > Kbps '
db 'x'; <- END MARKER, DONT DELETE
 
headers:
 
db 'ICY 200 OK',13,10
db 'icy-notice1:This stream requires Winamp or xmms',13,10
db 'icy-url:http://www.menuetos.org',13,10
db 'icy-pub: 1',13,10
db 'icy-name: Menuet Mp3 Shoutcast Radio ',version,' - '
transname:
db ' ',13,10,13,10
 
headere:
 
wls: db 'MP3 shoutcast server ',version
wle:
 
socket dd 0
status dd 0
 
posy dd 1
posx dd 0
 
read_on db 1
read_to dd 0
 
addr dd 0
ya dd 0
 
bps dd 128*1000
 
fileinfo: dd 0,0,0,0,0x20000
filename: db '/RD/1/MENUET.MP3',0
times 50 db 0
 
input_text:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mv/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mv.asm mv
@pause
/programs/mv/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mv.asm mv
@pause
/programs/mv/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mv/trunk/mv.asm
0,0 → 1,996
; Picture browser by lisovin@26.ru
; Modified by Ivan Poddubny - v.0.3
; Compile with FASM for Menuet
 
;******************************************************************************
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 temp_area , 0x0 ; I_Param , I_Icon
include 'lang.inc'
include 'macros.inc'
;******************************************************************************
 
tmp_param dd 0
 
START: ; start of execution
 
; check for parameters
cmp dword [temp_area],'BOOT'
jne .no_boot
call load_image
call convert
call background
or eax,-1
int 0x40
.no_boot:
 
cmp byte [temp_area],0
jz .no_param
mov edi,string ; clear string
mov ecx,43*3 ; length of a string
xor eax,eax ; symbol <0>
cld
rep stosb
 
mov edi,temp_area ; look for <0> in temp_area
mov ecx,43*3+1 ; strlen
repne scasb
add edi,-temp_area ; get length of the string
dec edi
 
mov ecx,edi
mov esi,temp_area
mov edi,string
rep movsb ; copy string from temp_area to "string" (filename)
 
call draw_window
mov [tmp_param],0xdeadbeef
.no_param:
 
 
mov ecx,-1 ; get information about me
call getappinfo
 
mov edx,[process_info+30] ; ⥯¥àì ¢ edx ­ è ¨¤¥­â¨ä¨ª â®à
mov ecx,eax
 
@@:
call getappinfo
cmp edx,[process_info+30]
je @f ; ¥á«¨ ­ è PID ᮢ¯ « á PID à áᬠâਢ ¥¬®£® ¯à®æ¥áá , ¬ë ­ è«¨ ᥡï
dec ecx ; ¨­ ç¥ ᬮâਬ á«¥¤ãî騩 ¯à®æ¥áá
jne @b ; ¢®§¢à é ¥¬áï, ¥á«¨ ­¥ ¢á¥ ¯à®æ¥ááë à áᬮâ७ë
@@:
 
; ⥯¥àì ¢ ecx ­®¬¥à ¯à®æ¥áá 
mov [process],ecx
 
cmp [tmp_param],0xdeadbeef
jne @f
jmp kopen
@@:
 
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:
bt [status],2
jnc @f
mov eax,18
mov ebx,3
mov ecx,[process]
int 0x40
btr [status],2
jmp still
@@:
call draw_window
jmp still
 
key: ; key
int 0x40
cmp ah,6
je kfile
cmp ah,15
je kopen
cmp ah,9
je kinfo
cmp ah,2
je kbgrd
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 nofile
kfile:
bt dword [status],0
jc still
bts dword [status],0
mov eax,51
mov ebx,1
mov ecx,thread1
mov edx,0x29fff0
int 0x40
jmp still
nofile:
cmp ah,3
jne noopen
 
kopen:
mov ecx,-1
call getappinfo
mov ebx,dword [I_END+42]
mov ecx,dword [I_END+46]
add ebx,10*65536-15
add ecx,50*65536-55
mov edx,0xffffff
mov eax,13
int 0x40
 
call load_image
 
open1:
cmp word [I_END],word 'BM'
jne still
call convert
call drawimage
jmp still
noopen:
 
cmp ah,4
jne noinfo
kinfo:
bt dword [status],1
jc still
bts dword [status],1
mov eax,51
mov ebx,1
mov ecx,thread2
mov edx,0x2afff0
int 0x40
jmp still
noinfo:
 
; “‘’€Ž‚ˆ’œ ”Ž
cmp ah,5
jne still
kbgrd:
bt dword [status],3
jc still
bts dword [status],3
mov eax,51
mov ebx,1
mov ecx,thread3
mov edx,0x2bfff0
int 0x40
jmp still
;call background
 
getappinfo:
mov eax,9
mov ebx,I_END
int 0x40
ret
 
 
load_image:
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx,fileinfo
int 0x40
cmp [I_END+2],dword 512 ; à §¬¥à ä ©«  (file size)
jbe open1
mov eax,[I_END+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
 
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
ret
 
 
drawimage:
cmp word [I_END],word 'BM'
jne nodrawimage
mov eax,7
mov ebx,[soi]
mov ecx,[I_END+18]
shl ecx,16
add ecx,[I_END+22]
mov edx,10*65536+50
int 0x40
nodrawimage:
ret
 
; “‘’€Ž‚ˆ’œ ”Ž
background:
cmp word [I_END],word 'BM'
jne @f
mov eax,15
mov ebx,1
mov ecx,[I_END+18] ; è¨à¨­ 
mov edx,[I_END+22] ; ¢ëá®â 
int 0x40
 
mov esi, ecx
imul esi, edx
imul esi, 3
mov ebx,5
mov ecx,[soi]
xor edx,edx
;;; mov esi, ;640*480*3
int 0x40
 
dec ebx ;tile/stretch
mov ecx,dword [bgrmode]
int 0x40
 
dec ebx
int 0x40
@@:
ret
 
convert:
movzx eax,word [I_END+28]
mul dword [I_END+18]
mov ebx,32
div ebx
test edx,edx
je noaddword
inc eax
noaddword:
mov [dwps],eax ;dwps-doublewords per string
shl eax,2
mov [bps],eax ;bps-bytes per string
 
cmp dword [I_END+34],0
jne yespicsize ;if picture size is defined
mul dword [I_END+22]
mov dword [I_END+34],eax
 
yespicsize:
mov eax,I_END
push eax
add eax, [I_END+2];file size
inc eax
mov [soi],eax ;soi-start of image area for drawing
pop eax
add eax, [I_END+10]
mov [sop],eax ;sop-start of picture in file
add eax, [I_END+34]
mov [eop],eax ;eop-end of picture in file
mov eax, [I_END+18]
mov ebx,3
mul ebx ;3x pixels in eax
 
mov edi,[soi] ;initializing
mov esi,[eop]
sub esi,[bps]
 
 
nextstring:
push edi
cmp word [I_END+28],24
jne convertno32
 
mov ecx,[dwps]
cld
rep movsd
convert1:
pop edi
sub esi,[bps]
sub esi,[bps]
cmp esi,[sop]
jb nomorestring
add edi,eax
jmp nextstring
 
nomorestring:
ret
 
convertno32:
mov ebx,I_END
add ebx, [I_END+14]
add ebx,14 ;start of color table
push esi
add esi,[bps]
mov [eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [I_END+28],4
je convert4bpp
cmp word [I_END+28],1
je convert1bpp
call converttable
convert2:
pop eax
inc esi
cmp esi,[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, [eax]
mov dword [edi],edx
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,350 ; [x start] *65536 + [x size]
mov ecx,400 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
int 0x40
 
mov eax,8
mov ebx,10*65536+46
mov ecx,25*65536+20
mov edx,2
mov esi,0x780078
newbutton:
int 0x40
add ebx,48*65536
inc edx
cmp edx,6
jb newbutton
 
; 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,12 ; text length
int 0x40
 
mov ebx,14*65536+32
mov edx,buttext
mov esi,26
int 0x40
 
call drawimage
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
; DATA AREA
 
labelt:
db 'MeView v.0.3'
 
lsz buttext,\
en, ' FILE OPEN INFO BGRD',\
ru, ' ”€‰‹ Ž’Š ˆ”Ž ”Ž '
 
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
 
thread1: ; start of thread1
 
call draw_window1
 
still1:
 
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je thread1
cmp eax,2 ; key in buffer ?
je key1
cmp eax,3 ; button in buffer ?
je button1
 
jmp still1
 
key1: ; key
int 0x40
cmp ah,179
jne noright
mov eax,[pos]
cmp eax,41
ja still1
inc eax
mov [pos],eax
call drawstring
jmp still1
noright:
cmp ah,176
jne noleft
mov eax,[pos]
test eax,eax
je still1
dec eax
mov [pos],eax
call drawstring
jmp still1
noleft:
cmp ah,182 ;del
jne nodelet
call shiftback
call drawstring
jmp still1
nodelet:
cmp ah,8 ;zaboy
jne noback
mov eax,[pos]
test eax,eax
je still1
dec eax
mov [pos],eax
call shiftback
call drawstring
jmp still1
noback:
cmp ah,13
jne noenter
enter1:
mov al,byte ' '
mov edi,string
mov ecx,43
cld
repne scasb
dec edi
mov byte [edi],0
jmp close1
noenter:
cmp ah,27
jne noesc
jmp enter1
noesc:
cmp dword [pos],42
jae still1
 
mov edi,string
add edi,42
mov esi,edi
dec esi
mov ecx,42
sub ecx,[pos]
std
rep movsb
 
shr eax,8
mov esi,string
add esi,[pos]
mov byte [esi],al
inc dword [pos]
call drawstring
 
jmp still1
 
button1: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose1
jmp enter1
close1:
bts dword [status],2
btr dword [status],0
mov eax,-1 ; close this program
int 0x40
noclose1:
cmp ah,2
jne nosetcur
mov eax,37
mov ebx,1
int 0x40
shr eax,16
sub eax,21
xor edx,edx
mov ebx,6
div ebx
mov [pos],eax
call drawstring
jmp still1
nosetcur:
jmp still1
 
 
shiftback:
mov edi,string
add edi,[pos]
mov esi,edi
inc esi
mov ecx,43
sub ecx,[pos]
cld
rep movsb
ret
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window1:
 
 
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+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+80 ; [y start] *65536 + [y size]
mov edx,0x03780078 ; 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,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt1 ; pointer to text beginning
mov esi,4 ; text length
int 0x40
 
call drawstring
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
drawstring:
pusha
mov eax,8 ;invisible button
mov ebx,21*65536+258
mov ecx,40*65536+15
mov edx,0x40000002
int 0x40
 
mov eax,13 ;bar
mov edx,0xe0e0e0
int 0x40
push eax ;cursor
mov eax,6*65536
mul dword [pos]
add eax,21*65536+6
mov ebx,eax
pop eax
mov edx,0x6a73d0
int 0x40
mov eax,4 ;path
mov ebx,21*65536+44
xor ecx,ecx
mov edx,string
mov esi,43
int 0x40
 
 
popa
ret
 
; DATA AREA
 
lsz labelt1,\
en, 'File',\
ru, '” ©«'
 
pos: dd 6
fileinfo:
dd 0
dd 0
dd 1 ;number of blocks of 512 bytes
dd I_END
dd temp_area
string:
; db '/HARDDISK/FIRST/1/DICK.BMP '
db '/hd/1/menuet/pics/new.bmp '
db ' '
db ' '
 
thread2: ; start of info thread
 
call draw_window2
 
still2:
 
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je thread2
cmp eax,2 ; key in buffer ?
je close2
cmp eax,3 ; button in buffer ?
je button2
 
jmp still2
 
button2: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose2
close2:
btr dword [status],1
bts dword [status],2
mov eax,-1 ; close this program
int 0x40
noclose2:
 
jmp still2
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window2:
 
 
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+330 ; [x start] *65536 + [x size]
mov ecx,100*65536+90 ; [y start] *65536 + [y size]
mov edx,0x03780078 ; 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,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt2 ; pointer to text beginning
mov esi,labelt2.size ; text length
int 0x40
 
mov ebx,10*65536+30
mov edx,string
mov esi,43
int 0x40
mov edx,fitext
mov esi,14
add ebx,70*65536+10
followstring:
int 0x40
add ebx,10
add edx,esi
cmp ebx,80*65536+70
jbe followstring
mov eax,47
mov edx,200*65536+40
mov esi,ecx
mov ecx, [I_END+2]
call digitcorrect
int 0x40
add edx,10
mov ecx, [I_END+18]
call digitcorrect
int 0x40
add edx,10
mov ecx, [I_END+22]
call digitcorrect
int 0x40
add edx,10
movzx ecx,word [I_END+28]
call digitcorrect
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
digitcorrect:
xor ebx,ebx
mov bh,6
cmp ecx,99999
ja c_end
dec bh
cmp ecx,9999
ja c_end
dec bh
cmp ecx,999
ja c_end
dec bh
cmp ecx,99
ja c_end
dec bh
cmp ecx,9
ja c_end
dec bh
c_end:
bswap ebx
ret
 
 
; DATA AREA
 
lsz labelt2,\
en, 'File info',\
ru, 'ˆ­ä®à¬ æ¨ï ® ä ©«¥'
 
lsz fitext,\
en, 'FILE SIZE ',\
en, 'X SIZE ',\
en, 'Y SIZE ',\
en, 'BITS PER PIXEL',\
\
ru, ' §¬¥à ä ©«  ',\
ru, '˜¨à¨­  ',\
ru, '‚ëá®â  ',\
ru, '¨â ­  ¯¨ªá¥« '
 
thread3: ; start of bgrd thread
 
call draw_window3
 
still3:
 
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je thread3
cmp eax,2 ; key in buffer ?
je key3
cmp eax,3 ; button in buffer ?
je button3
 
jmp still3
 
key3:
int 0x40
cmp ah,27
je close3
cmp ah,13
je kok
cmp ah,178 ;up
jne nofup
cmp dword [bgrmode],1
je fdn
fup:
dec dword [bgrmode]
jmp flagcont
nofup:
cmp ah,177 ;down
jne still3
cmp dword [bgrmode],2
je fup
fdn:
inc dword [bgrmode]
jmp flagcont
 
 
button3: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose3
close3:
btr dword [status],3
bts dword [status],2
mov eax,-1 ; close this program
int 0x40
noclose3:
cmp ah,4
jne nook
kok:
call background
jmp close3
nook:
cmp ah,2
jb still3
cmp ah,3
ja still3
dec ah
mov byte [bgrmode],ah
flagcont:
call drawflags
jmp still3
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window3:
 
 
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+200 ; [x start] *65536 + [x size]
mov ecx,100*65536+100 ; [y start] *65536 + [y size]
mov edx,0x03780078 ; color of work area RRGGBB,8->color gl
int 0x40
 
mov eax,8
mov ebx,70*65536+40
mov ecx,70*65536+20
mov edx,4
mov esi,0xac0000
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,labelt3 ; pointer to text beginning
mov esi,14 ; text length
int 0x40
add ebx,38*65536+20
mov ecx,0xddeeff
mov edx, bgrdtext
mov esi, bgrdtext.size
int 0x40
add ebx,40*65536+15
mov edx, tiled
mov esi, tiled.size
int 0x40
add ebx,15
mov edx, stretch
mov esi, stretch.size ;7
int 0x40
add ebx,18
mov edx, ok_btn
mov esi, ok_btn.size ;2
int 0x40
 
call drawflags
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
drawflags:
mov eax,8
mov ebx,70*65536+10
mov ecx,40*65536+10
mov edx,2
mov esi,0xe0e0e0
int 0x40
add ecx,15*65536
inc edx
int 0x40
mov eax,4
mov ebx,73*65536+42
xor ecx,ecx
mov edx,vflag
mov esi,1
cmp dword [bgrmode],1
je nodownflag
add ebx,15
nodownflag:
int 0x40
ret
 
 
; DATA AREA
vflag: db 'x'
bgrmode: dd 1
 
lsz labelt3,\
en, 'Background set',\
ru, "“áâ ­®¢ª  ä®­ "
 
lsz bgrdtext,\
en, 'SET AS BACKGROUND:',\
ru, '’¨¯ ®¡®¥¢:'
 
lsz tiled,\
en, 'TILED',\
ru, '§ ¬®áâ¨âì'
 
lsz stretch,\
en, 'STRETCH',\
ru, 'à áâï­ãâì'
 
lsz ok_btn,\
en, 'Ok',\
ru, 'Ok'
 
 
 
IM_END:
temp_area:
rb 0x10000
I_END:
process_info:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mview/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mview.asm mview
@pause
/programs/mview/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mview.asm mview
@pause
/programs/mview/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/mview/trunk/mview.asm
0,0 → 1,1439
; CODE VIEWER - Compile with FASM for Menuet
;B+ System header
use32
org 0x0
db 'MENUET00'
dd 38
dd START
dd I_END
dd 0x100000
dd 0x00000000
 
include 'lang.inc'
include 'macros.inc'
;E:.
;B+ Definitions
type_begin equ 0
type_end_normal equ 2
type_not_end equ 4
type_end_plus equ 6
type_include equ 8
type_file_end equ 11
; +1, if active jump
char_end equ 11
new_line equ 10
win_width equ (496+6*6)
win_field equ (4+10+6*6)
win_toptext equ 38+4
;B+ Keys
KEY_UP equ (130+48)
KEY_DOWN equ (129+48)
KEY_PGUP equ (136+48)
KEY_PGDOWN equ (135+48)
;E:.
start_data equ (I_END+10+27+16)
;E:.
;B+ Execution
START:
jmp load_file1
;B+ Main cicle
redr:
call draw_window
still:
mov eax,10
int 0x40
still_:
cmp eax,1
je redr
cmp eax,2
jne no_key
mov eax,2
int 0x40
jmp key
no_key:
cmp eax,3
jne still
mov eax,17
int 0x40
cmp ah,1
jne .no_close
mov eax,-1
int 0x40
.no_close:
jmp button
jmp still
;E:.
key:
;B+ Scroll text
mov ebx,[top_pos]
mov [activ_pos],ebx
mov bx,[top_line]
mov [activ_line],bx
mov bx,[top_depth]
mov [activ_depth],bx
mov ebx,[top_file]
mov [activ_file],ebx
cmp ah,KEY_DOWN ;key_up
jne .no_down
call line_down
jmp .save_shift
.no_down:
cmp ah,KEY_UP ;key down
jne .no_up
call line_up
jmp .save_shift
.no_up:
cmp ah,KEY_PGUP ;key page up
jne .no_pgup
mov edi,35
.next_line:
call line_up
dec edi
jnz .next_line
jmp .save_shift
.no_pgup:
cmp ah,KEY_PGDOWN ;key page down
jne .no_pgdown
mov edi,35
.next_line1:
call line_down
dec edi
jnz .next_line1
jmp .save_shift
.no_pgdown:
jmp still
.save_shift:
mov ebx,[activ_pos]
mov [top_pos],ebx
mov bx,[activ_line]
mov [top_line],bx
mov bx,[activ_depth]
mov [top_depth],bx
mov ebx,[activ_file]
mov [top_file],ebx
; Show new text
mov ebx,1
mov eax,12
int 0x40
call show_text
mov ebx,2
mov eax,12
int 0x40
jmp still
;E:.
button:
;B+ Distribute button events
shr eax,8
and eax,0xff
cmp eax,100
jge down_buttons
;B+ Left buttons
;B+ Find line place
sub eax,2
mov ebx,[top_pos]
mov [activ_pos],ebx
mov bx,[top_depth]
mov [activ_depth],bx
mov ebx,[top_file]
mov [activ_file],ebx
mov bx,[top_line]
mov [activ_line],bx
mov ecx,eax
or ecx,ecx
jz .line_find
.next_line:
push ecx
call line_down
pop ecx
loop .next_line
.line_find:
mov ebx,[activ_pos]
;E:.
;B+ Switch, if special line
mov cx,[ebx]
test cx,not 15
jnz still
cmp cx,type_begin
je .is_begin_end
cmp cx,type_begin+1
jne .not_begin_end
.is_begin_end:
xor [ebx],word 1
mov ebx,[ebx+4]
add ebx,[activ_file]
xor [ebx],word 1
jmp .paint
.not_begin_end:
cmp cx,type_include
je .open_file
;close file
cmp cx,type_include+1
jne .not_include
xor [ebx],word 1
jmp .paint
.open_file:
;Open file
cmp dword [ebx+4],-1
je .load_file
xor [ebx],word 1
jmp .paint
.paint1:
pop ebx
jmp .paint
.load_file:
push ebx
;B+ Prepare file name
mov ecx,26
mov edi,incl_filename
mov al,' '
cld
rep stosb
mov cl,[skoba_txt]
mov ch,[skoba_txt+1]
add ebx,12
.next_char:
cmp [ebx],cl
je .begin
cmp byte [ebx],new_line
je .paint1
inc ebx
jmp .next_char
.begin:
inc ebx
mov esi,ebx
.next_char1:
cmp [ebx],ch
je .end
cmp byte [ebx],new_line
je .paint1
inc ebx
jmp .next_char1
.end:
sub ebx,esi
mov edi,incl_filename
mov ecx,ebx
push ecx
rep movsb
; mov al,0
; stosb
;Save in memory
mov ecx,[esp]
mov esi,incl_filename
mov edi,[end_of_file]
rep movsb
pop ecx
mov [edi],ecx
add ecx,2
add [end_of_file],ecx
mov ebx,[esp]
;E:.
mov edi,[top_free_file]
mov [ebx+4],edi
mov [activ_pos],ebx
mov eax,[activ_file]
sub ebx,eax
mov [incl_line],ebx
push eax
call line_down
pop eax
mov ebx,[activ_pos]
sub ebx,eax
mov [incl_next],ebx
pop ebx
xor [ebx],word 1
push eax
mov eax,[end_of_file]
add eax,16
mov [activ_file],eax
lea edi,[file_array+4*edi]
mov [edi],eax
mov [activ_pos],eax
mov ebx,[incl_line]
mov [eax-12],ebx
mov bx,[activ_line]
dec bx
mov word [eax-6],bx
;B+ Save number for new file
mov ebx,[esp]
cmp ebx,[file_array]
jne .no_root
mov [eax-8],word 0
jmp .parent_ok
.no_root:
mov ebx,[esp]
mov bl,[ebx-2]
and ebx,0xff
mov [eax-8],bx
.parent_ok:
push eax
;E:.
call add_file
mov edi,[block_pointer]
mov word [edi+4],char_end
add [block_pointer],8
push edi
call fresh_file
pop edi eax
mov [block_pointer],edi
;B+ Save newfile line count
mov edi,[line_]
mov word [eax-4],di
;E:.
pop eax
mov [activ_file],eax
inc [top_free_file]
jmp .paint
.not_include:
.paint:
mov ebx,1
mov eax,12
int 0x40
call show_text
mov ebx,2
mov eax,12
int 0x40
;E:.
jmp still
;E:.
down_buttons:
;B+ If down buttons
cmp eax,101
je load_file ;Button 'Load'
sub eax,100
mov edx,[str_table+4*eax]
mov [str_start],edx
;B+ Clear old info
push edx
;clear text
mov ecx,0xaa0000
call print_str
pop edx
;clear memory place
mov ecx,[edx]
lea edi,[edx+8]
mov eax,' '
cld
rep stosb
;E:.
mov ebx,[edx]
mov [max_len],ebx
mov ebx,[edx+4]
jmp load_str
save_str:
;B+ Save in base place
;B+ If file convert to upper case
mov eax,it1
cmp eax,[str_start]
jne .no_file
mov ecx,0xaa0000
mov edx,str_
mov esi,[it1]
mov ebx,[it1+4]
mov eax,4
int 0x40
mov edx,edi
mov eax,str_
dec eax
inc edx
.next_char:
inc eax
dec edx
jz .no_file
cmp byte [eax],'a'
jl .next_char
cmp byte [eax],'z'
jg .next_char
add byte [eax],'A'-'a'
jmp .next_char
.no_file:
;E:.
mov edx,[str_start]
add edx,8
mov ecx,edi
add edi,edx
mov byte [edi],char_end
mov eax,it1
cmp eax,[str_start]
jne .no_null
mov byte [edi],' ' ;0
.no_null:
mov esi,str_
mov edi,edx
cld
rep movsb
mov ecx,0xffffff
jmp print_str
;E:.
;E:.
;E:.
;B+ String tools
;B+ Data for load string
curs db '_'
str_: times 100 db ' '
db char_end
max_len dd 10
;E:.
load_str:
;B+ Load text field
xor edi,edi
mov ecx,0xffaaaa
mov esi,1
.next_char:
mov edx,curs
mov eax,4
int 0x40
;B+ Get key event
mov eax,10
int 0x40
push eax
mov ecx,0xaa0000
mov eax,4
int 0x40
pop eax
cmp eax,2
je .yes_key
call save_str
jmp still_
.yes_key:
mov eax,2
int 0x40
;E:.
;B+ Test enter
cmp ah,13
jne .no_ok
call save_str
jmp still
.no_ok:
;E:.
;B+ Test backspace
cmp ah,8
jne .no_backsp
or edi,edi
jz .next_char
mov byte [str_+edi],' '
mov ecx,0xaa0000
mov eax,4
int 0x40
dec edi
sub ebx,6*65536
lea edx,[str_+edi]
int 0x40
mov ecx,0xffaaaa
jmp .next_char
.no_backsp:
;E:.
;B+ Prin 1 char
mov [str_+edi],ah
mov ecx,0xaa0000
mov eax,4
int 0x40
mov ecx,0xffaaaa
lea edx,[str_+edi]
cmp [max_len],edi
je .next_char
int 0x40
add ebx,6*65536
inc edi
;E:.
jmp .next_char
;E:.
print_str:
;B+ Print select string
mov ebx,[str_start]
lea edx,[ebx+8]
mov esi,[ebx]
mov ebx,[ebx+4]
mov eax,4
int 0x40
;B+ Test special strings
pusha
mov eax,[str_start]
cmp eax,it2
jge .is_ok1
popa
ret
.is_ok1:
cmp eax,it3
jle .is_ok
popa
ret
.is_ok:
;E:.
add eax,8
.next_char:
mov esi,1
cmp byte [eax],' '
jne .no_space
;B+ Draw special space
push eax
mov edx,space
mov eax,4
int 0x40
push ebx
sub ebx,1*65536
mov edx,dot
int 0x40
add ebx,3*65536
int 0x40
pop ebx
pop eax
;E:.
.no_space:
add ebx,6*65536
cmp byte [eax],char_end
jne .no_ret
popa
ret
.no_ret:
inc eax
jmp .next_char
space db '_'
dot db '.'
;E:.
;E:.
;B+ Add / remove files
add_file:
;B+ Load and link file
mov eax,[activ_file]
push eax
mov ebx,incl_filename
mov ecx,0
mov edx,-1
mov esi,eax
mov eax,6
int 0x40
mov ebx,[esp]
inc eax
mov [ebx-16],eax
dec eax
add ebx,eax
add eax,16+15 +20 ;???
add [end_of_file],eax
mov byte [ebx],new_line
mov word [ebx+1],char_end
mov ax,[activ_line]
mov word [ebx+3],ax
mov eax,[incl_next]
mov [ebx+5],eax
mov dword [ebx+9],new_line
mov byte [ebx+13],new_line
pop ebx
mov eax,[top_free_file]
mov byte [ebx-2],al ; this file num
mov byte [ebx-1],new_line
ret
;E:.
;B+ Include file data
incl_filename db 'KERNEL.ASM'
if_e:
times (26+incl_filename-if_e) db ' '
incl_line dd 0x0
incl_next dd 0x0
;E:.
;E:.
;E:.
;B+ Visualization tools
draw_window:
;B+ Redraw window
mov ebx,1
mov eax,12
int 0x40
;B+ Draw window
mov ebx,((640-win_width)/2)*65536+win_width
mov ecx,10*65536+win_toptext+35*10+1+2*16
mov edx,[color_depth]
or edx,0x03000000
mov esi,0x80aaaaff
mov edi,0x00009000
mov eax,0x0
int 0x40
;E:.
;B+ Draw caption
mov ebx,8*65537
mov ecx,0xffffff
mov edx,caption
mov esi,caption_end-caption
mov eax,4
int 0x40
;E:.
;B+ Draw first line
mov ebx,5*65536+win_width-9
mov ecx,25*65536+win_toptext-22-4
mov edx,0xaa0000
mov eax,13
int 0x40
mov ebx,21*65536+29
mov ecx,0xffffff
mov edx,line1up1
mov esi,line1up1_end-line1up1
mov eax,4
int 0x40
mov ebx,(win_field+6)*65536+29
mov edx,line1up2
mov esi,line1up2_end-line1up2
int 0x40
;E:.
;B+ Main text zone
;B+ Fill text
;Clear type lines
mov edi,lines_view
mov ecx,35
mov eax,0
cld
repe stosd
call show_text
;E:.
;B+ Define left buttons
; mov ebx,5*65536+9
; mov ecx,win_toptext*65536+9
; mov edx,0
; mov esi,0x9000a0
; mov eax,8
; mov edi,35
;.new_button:
; int 0x40
; add ecx,10*65536
; inc edx
; dec edi
; jnz .new_button
;E:.
;B+ Vertical line
mov ebx,(win_field-1)*65537
mov ecx,24*65536+win_toptext+35*10
mov edx,0xffffff
mov eax,38
int 0x40
;E:.
;E:.
;B+ Down controle zone
mov ebx,5*65536+win_width-9
mov ecx,(35*10+win_toptext+1)*65536+28
mov edx,0xaa0000
mov eax,13
int 0x40
mov eax,line1down
mov ebx,filetxt
mov ecx,filetxt_end
call ins_button_prep
mov edx,100
mov eax,8
int 0x40
mov eax,line1down
mov ebx,loadtxt
mov ecx,loadtxt_end
call ins_button_prep
inc edx
mov eax,8
int 0x40
mov eax,line1down
mov ebx,begintxt
mov ecx,begintxt_end
call ins_button_prep
inc edx
mov eax,8
int 0x40
mov eax,line1down
mov ebx,endtxt
mov ecx,endtxt_end
call ins_button_prep
inc edx
mov eax,8
int 0x40
mov eax,line2down
mov ebx,inctxt
mov ecx,inctxt_end
call ins_button_prep
add ecx,14*65536
inc edx
mov eax,8
int 0x40
mov eax,line2down
mov ebx,septxt
mov ecx,septxt_end
call ins_button_prep
add ecx,14*65536
inc edx
mov eax,8
int 0x40
mov ebx,22*65536+35*10+win_toptext+4
mov ecx,0xffffff
mov edx,line1down
mov esi,line1down_end-line1down
mov eax,4
int 0x40
add ebx,14
mov edx,line2down
mov esi,line2down_end-line2down
int 0x40
;E:.
;B+ Down controle strings
mov ecx,0xffffff
mov eax,it1
mov [str_start],eax
call print_str
mov eax,it2
mov [str_start],eax
call print_str
mov eax,it3
mov [str_start],eax
call print_str
mov eax,it4
mov [str_start],eax
call print_str
mov eax,it5
mov [str_start],eax
call print_str
;E:.
mov ebx,2
mov eax,12
int 0x40
ret
;E:.
ins_button_prep:
;B+ Insert button
push edx
push eax
sub ecx,ebx
mov eax,6
mul ecx
add eax,6
push ax
mov eax,[esp+2]
sub ebx,eax
mov eax,6
mul ebx
add eax,18
xchg eax,ebx
shl ebx,16
pop bx
mov ecx,(35*10+win_toptext+1)*65536+13
mov esi,0x00a050
pop eax
pop edx
ret
;E:.
show_text:
;B+ Show text
;B+ Show file on top
mov ebx,(win_field+45)*65536+win_width-(win_field+45+8)
mov ecx,25*65536+win_toptext-22-4
mov edx,0xaa0000
mov eax,13
int 0x40
mov edx,[top_file]
xor esi,esi
mov si,[edx-18]
sub edx,18
sub edx,esi
mov ebx,(win_field+45)*65536+29
mov ecx,0xffaaaa
mov eax,4
int 0x40
;E:.
mov ax,[top_line]
mov [activ_line],ax
mov ebx,[top_pos]
mov [activ_pos],ebx
mov ax,[top_depth]
mov [activ_depth],ax
mov eax,[top_file]
mov [activ_file],eax
mov ecx,35
mov [line_],0
.next_line:
cmp [activ_depth],0
jne .next
cmp byte [ebx],char_end
je .end_of_file
.next:
push ecx
call show_line
call line_down
inc [line_]
pop ecx
loop .next_line
ret
.end_of_file:
push ecx
call clear_line
inc [activ_pos]
inc [line_]
pop ecx
loop .end_of_file
ret
;E:.
;B+ Button chars
leftchars db '-','+',' ','H'
db '?', 0 ,'!','H'
db '&','x',' ', 0
;E:.
show_line:
;B+ Show line
call clear_line
mov ebx,ecx
shr ebx,16
inc ebx
or ebx,(win_field+6)*65536
push ebx
push eax
;B+ Draw left button char
mov eax,[activ_pos]
mov ax,[eax]
test ax,not 15
jnz .no_text
and eax,0xff
lea edx,[leftchars+eax]
and ebx,0xffff
or ebx,8*65536
mov ecx,0xffffff
mov esi,1
mov eax,4
int 0x40
mov ebx,[esp+4]
.no_text:
;E:.
;B+ Draw line number
xor ecx,ecx
mov cx,[activ_line]
mov edx,(10+4+4)*65536
mov dx,bx
mov ebx,5*65536
mov esi,0xeeeeee
mov eax,47
int 0x40
;E:.
;B+ Find line length
xor esi,esi
mov eax,[activ_pos]
cmp byte [eax],new_line
je .len_ok
test word [eax],not 15
jnz .next_char
add eax,12 ;sckip system zone
.next_char:
cmp byte [eax],new_line
je .len_ok
inc esi
inc eax
jmp .next_char
.len_ok:
mov eax,6
mul esi
mov ecx,eax
add ecx,6
pop eax
mov [eax+2],cx
;E:.
mov ecx,[textcolor]
mov edx,[activ_pos]
xor edi,edi
xor ebx,ebx
mov bx,word [edx]
cmp bl,new_line
je .normal_show_line
test bx,not 15
jnz .normal_show_line
or edi,ebx
mov ecx,[color_type+4*ebx]
add edx,12 ;sckip system zone
.normal_show_line:
pop ebx
mov eax,4
int 0x40
test edi,4 ;bad type close block
jz .nobad
add ebx,65536
int 0x40
.nobad:
ret
;E:.
color_type:
;B+ Color data
dd 0x00dddd,0x00ee00 ;0/1 begin 00ee00
dd 0x00b5b5,0xffa000 ;2/3 end 00d000
dd 0xffffff,-1 ;4 text end
dd 0x00b5b5,0xffa000 ;6/7 auto end
dd 0x80ccff,0x80aaff ;8/9 include
dd -1 ,0xffa000 ;11 file end
textcolor dd 0xffffff
;E:.
clear_line:
;B+ Clear text in line
;B+ Find line position
mov eax,[line_]
mov ecx,10
mul cx
mov ecx,eax
add ecx,win_toptext
;E:.
;B+ Draw/clear button
push ecx
shl ecx,16
mov cx,9
mov ebx,5*65536+9
mov edx,[line_]
add edx,2
mov esi,0x9000a0
mov eax,8
int 0x40
pop ecx
;E:.
;B+ Clear zone for line
shl ecx,16
mov cx,10
mov ebx,(5+11)*65536+win_field-5-12
xor edx,edx
mov dx,[activ_depth]
mov edx,[color_depth+4*edx]
mov eax,13
int 0x40
;E:.
;B+ Clear main text zone
mov ebx,(win_field)*65536+(win_width-win_field-8)
mov eax,[line_]
lea eax,[lines_view+4*eax]
push eax
mov ax,[eax]
cmp ax,[activ_depth]
jne .draw_all_line
mov eax,[esp]
cmp bx,[eax+2]
jle .draw_all_line
mov bx,[eax+2]
.draw_all_line:
mov eax,13
int 0x40
;E:.
;B+ Update line type I
pop eax
mov bx,[activ_depth]
mov [eax],bx
;E:.
ret
activ_depth dw 0x0
color_depth dd 0x404040,0x606060,0x707070,0x7a7a7a
dd 0x878787,0x909090,0x9a9a9a,0xa5a5a5
dd 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
lines_view: times 35 dd 0
;E:.
line_up:
;B+ Line up
;B+ Test jumps I
mov ebx,[activ_pos]
cmp ebx,[activ_file]
jne .yes_scroll
cmp [activ_depth],0
jz .top_of_file
dec [activ_depth]
xor eax,eax
mov ax,[ebx-8]
mov eax,[file_array+4*eax]
mov [activ_file],eax
add eax,[ebx-12]
mov [activ_pos],eax
mov ax,[ebx-6]
mov [activ_line],ax
.top_of_file:
ret
;E:.
.yes_scroll:
sub ebx,2
.normal_line_up1:
cmp byte [ebx],new_line
je .line_ok
dec ebx
jmp .normal_line_up1
.line_ok:
;B+ Test for special line
cmp dword [ebx],new_line
jne .line_ok1
sub ebx,9
;E:.
.line_ok1:
inc ebx
test word [ebx],not 15
jnz .normal_line_up
test word [ebx],1
jz .normal_line_up
;B+ Test jumps II
cmp word [ebx],type_end_normal+1
je .to_begin
cmp word [ebx],type_end_plus+1
je .to_begin
cmp word [ebx],type_include+1
je .to_incl
jmp .normal_line_up
;E:.
.to_begin:
mov eax,[ebx+4]
add eax,[activ_file]
mov [activ_pos],eax
mov ax,[ebx+2]
inc ax
sub [activ_line],ax
ret
.to_incl:
inc [activ_depth]
mov eax,[ebx+4]
mov eax,[file_array+4*eax]
mov [activ_file],eax
mov bx,[eax-4]
mov [activ_line],bx
add eax,[eax-16]
mov [activ_pos],eax
ret
.normal_line_up:
mov [activ_pos],ebx
dec [activ_line]
ret
;E:.
line_down:
;B+ Line down
mov ebx,[activ_pos]
cmp byte [ebx],char_end
jne .yes_scroll
cmp [activ_depth],0
jne .yes_scroll
ret
.yes_scroll:
cmp byte [ebx],new_line
je .normal_line_down
test word [ebx],not 15
jnz .normal_line_down
test word [ebx],1
jz .not_activated
;B+ Test jumps
cmp word [ebx],type_begin+1
jne .no_begin
mov eax,[ebx+4]
add eax,[activ_file]
mov [activ_pos],eax
mov ax,[ebx+2]
add [activ_line],ax
call line_down
ret
.no_begin:
cmp word [ebx],type_end_normal+1
je .not_activated
cmp word [ebx],type_end_plus+1
je .not_activated
;goto include
cmp word [ebx],type_include+1
jne .no_incl
inc [activ_depth]
mov eax,[ebx+4]
mov eax,[file_array+4*eax]
mov [activ_file],eax
mov [activ_pos],eax
mov [activ_line],1
ret
.no_incl:
;return from include
cmp word [ebx],type_file_end
jne .no_end
;CHECK FOR FIRST
mov ax,[ebx+2]
mov [activ_line],ax
dec [activ_depth]
mov ecx,[activ_file]
xor eax,eax
mov ax,[ecx-8]
mov eax,[file_array+4*eax]
mov [activ_file],eax
add eax,[ebx+4]
mov [activ_pos],eax
mov ebx,eax
ret
.no_end:
;E:.
.not_activated:
add ebx,12 ;sckip system zone
.normal_line_down:
cmp byte [ebx],new_line
je .line_ok
cmp byte [ebx],char_end
inc ebx
jmp .normal_line_down
.line_ok:
inc ebx
mov [activ_pos],ebx
inc [activ_line]
ret
;E:.
;B+ File possition var.
line_ dd 0x0 ;Line on screen
top_pos dd start_data
top_line dw 1
top_depth dw 0x0
activ_pos dd start_data
activ_line dw 0x0 ;Abs line in file
;E:.
;E:.
;B+ Load file tools
load_file:
;B+ Main
;B+ Init parameters
mov [top_pos],start_data
mov [activ_pos],start_data
mov [top_file],start_data
mov [activ_file],start_data
mov [file_array],start_data
mov [top_free_file],1
mov [end_of_file],start_data
mov [top_line],1
mov esi,file_txt
mov edi,incl_filename
mov ecx,25
cld
rep movsb
;E:.
load_file1:
;B+ Load and fresh file
mov eax,[end_of_file]
push eax
call add_file
mov edi,[esp]
mov esi,incl_filename
sub edi,16+25+2
mov ecx,27
cld
rep movsb
pop edi
mov word [edi-18],25
mov eax,[top_pos]
mov [activ_pos],eax
call fresh_file
call draw_window
jmp still
;E:.
;E:.
fresh_file:
;B+ Fresh file
mov [line_],0
mov [next_],next
.fresh_next:
inc [line_]
;Test open block
mov eax,[begin_txt]
mov ebx,[activ_pos]
cmp [ebx],eax
je block_begin
;Test close block
mov eax,[end_txt]
cmp [ebx],eax
je block_end
;B+ Test include
mov esi,ebx
mov edi,include_txt
mov ecx,20
cld
rep cmpsb
cmp byte [edi-1],char_end
je include_file
;E:.
next:
;B+ Go to next line
mov ebx,[activ_pos]
.next_char:
cmp byte [ebx],new_line
je yes_next
cmp byte [ebx],char_end
je file_end
inc ebx
jmp .next_char
yes_next:
inc ebx
inc [activ_line]
mov [activ_pos],ebx
jmp fresh_file.fresh_next
;E:.
file_end:
;B+ Auto set close block
mov [next_],.try_fill_next
sub ebx,5
dec [activ_line]
mov [activ_pos],ebx
.try_fill_next:
add [activ_pos],5
inc [activ_line]
mov ebx,[activ_pos]
mov eax,[end_txt]
mov ecx,[block_pointer]
cmp word [ecx-4],char_end
je .fill_ok
inc [line_]
call ins_5_bytes
mov dword [ebx],eax
mov byte [ebx+4],new_line
mov byte [ebx+5],char_end
mov [activ_pos],ebx
jmp block_end
;E:.
.fill_ok:
ret
;E:.
;B+ Specify line markers
block_begin:
;B+ Mark block begin
;B+ Mark info in stack
mov eax,[activ_pos]
mov ebx,[block_pointer]
push eax
sub eax,[activ_file]
mov [ebx],eax
pop eax
mov word [ebx+4],0
mov cx,[activ_line]
mov word [ebx+6],cx
add ebx,8
mov [block_pointer],ebx
;E:.
call ins_12_bytes
;line / possition not ready
mov word [eax],type_begin+1
mov dword [eax+8],new_line
add [activ_pos],12
jmp [next_]
;E:.
block_end:
;B+ Mark block end
;B+ Mark end type I
mov eax,[activ_pos]
call ins_12_bytes
mov ecx,[block_pointer]
cmp word [ecx-4],char_end
je .normal_line
;E:.
;Pop stack
sub [block_pointer],8
sub ecx,8
;B+ Form this (END) line/place to BEGIN
mov edx,[ecx]
add edx,[activ_file]
mov eax,[activ_pos]
sub eax,[activ_file]
mov [edx+4],eax
mov bx,[activ_line]
sub bx,[ecx+6]
mov [edx+2],bx
;E:.
;B+ From stack line/place to this (END)
mov eax,[activ_pos]
mov edx,[ecx]
mov [eax+4],edx
mov [eax+2],bx
;E:.
;B+ Mark end type II
mov word [eax],type_end_normal+1
mov ecx,[next_]
cmp ecx,next
je .yes_normal
mov word [eax],type_end_plus+1
.yes_normal:
mov dword [eax+8],new_line
add [activ_pos],12
jmp [next_]
.normal_line:
mov word [eax],type_not_end
mov dword [eax+8],new_line
add [activ_pos],12
jmp [next_]
;E:.
;E:.
include_file:
;B+ Include and attach file
mov eax,[activ_pos]
push eax
call ins_12_bytes
pop eax
mov word [eax],type_include
mov word [eax+2],0
mov dword [eax+4],-1
mov dword [eax+8],new_line
dec [line_]
jmp [next_]
;E:.
next_ dd next
;E:.
;B+ Additional tools
ins_12_bytes:
mov ecx,[end_of_file]
add [end_of_file],12
mov esi,ecx
add ecx,12
mov edi,ecx
sub ecx,11
sub ecx,eax
std
rep movsb
mov ecx,[activ_file]
add dword [ecx-16],12
ret
ins_5_bytes:
mov ecx,[end_of_file]
add [end_of_file],5
mov esi,ecx
add ecx,5
mov edi,ecx
sub ecx,4
sub ecx,ebx
std
rep movsb
mov ecx,[activ_file]
add dword [ecx-16],5
ret
ins_1_byte:
mov ecx,[end_of_file]
inc [end_of_file]
mov esi,ecx
inc ecx
mov edx,ecx
sub ecx,ebx
std
rep movsb
mov ecx,[activ_file]
inc dword [ecx-16]
ret
;E:.
;E:.
;B+ Data section
;B+ View data
caption db 'CODE VIEWER - ver. 0.2'
caption_end:
line1up1 db 'LINE'
line1up1_end:
line1up2 db 'FILE:'
line1up2_end:
line1down:
filetxt db 'FILE->'
filetxt_end:
times 28 db ' '
loadtxt db 'LOAD'
loadtxt_end:
db ' BLOCK: '
begintxt db 'BEGIN->'
begintxt_end:
times 10 db ' '
db '...'
times 10 db ' '
endtxt db '<-END'
endtxt_end:
line1down_end:
line2down:
inctxt db 'INCLUDE KEYWORD->'
inctxt_end:
times 46 db ' '
septxt db 'SEPARATORS->'
septxt_end:
line2down_end:
;E:.
;B+ Parameter strings
str_start dd it1
str_table dd it1,0,it2,it3,it4,it5
;align
it1:
dd 25
dd (20+6*7)*65536+35*10+win_toptext+3
file_txt:
db 'KERNEL.ASM ',char_end
;align 4
it2:
dd 4
dd (20+56*6)*65536+35*10+win_toptext+3
begin_txt:
db ';B+ ',char_end
;align 4
it3:
dd 4
dd (20+71*6)*65536+35*10+win_toptext+3
end_txt:
db ';E:.',char_end
;align 4
it4:
dd 43
dd (20+18*6)*65536+35*10+win_toptext+3+14
include_txt:
db 'include ',char_end,' '
;align 4
it5:
dd 2
dd (20+76*6)*65536+35*10+win_toptext+3+14
skoba_txt:
db '"" ',char_end
;E:.
block_pointer dd block_stack+8
block_stack dw 0,0,char_end,0
times 10*2 dd 0x0
; STACK BOX:
; ÚÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÏ
; Óabs placeÓ 0 ÓlineÓ
; ÀÄÄÄÄÄÄÄÄÄÁÄÄÄÄÁÄÄÄÄÙ
; or 0000 'char_end' 00 - bottom
top_file dd start_data
activ_file dd start_data
top_free_file dd 1
file_array dd start_data
times 50 dd 0x0
end_of_file dd start_data
; TEXT MARKER:
; ÚÄÄÄÄÂÄÄÄÄÂÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÏ
; ÓtypeÓn.l.Ónew placeÓ 13 Ó
; ÀÄÄÄÄÁÄÄÄÄÁÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÙ
;E:.
;B+ Program preview
;ÚÄÄÄÄÄ
;ÓCODE VIEWER - ver. 0.2 o _ x
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;Ó Line | File:
;Ó---------+---------------------
;Ó[+] |
;Ó[-] |
;Ó[ ] |
;Ó[#] |
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;Ó [FILE->]___________ [LOAD] BLOCK: [BEGIN->];B+ú ... ;E:.[<-END] Ó
;Ó [INCLUDE KEYWORD->]include [SEPARATORS->]""
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;E:.
I_END:
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/netsendc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm netsendc.asm netsendc
@pause
/programs/netsendc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm netsendc.asm netsendc
@pause
/programs/netsendc/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/netsendc/trunk/netsendc.asm
0,0 → 1,198
;
; NetSend(Client)
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
;
; Ž¯¨á ­¨¥:
; à®£à ¬¬  ¤«ï ®¡¬¥­  á®®¡é¥­¨ï¬¨ ¢ á¥â¨.Š«¨¥­â᪠ï ç áâì.
;
; Compile with FASM for Menuet
; Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
;
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,53 ; open socket
mov ebx,0
mov ecx,0x4000 ; local port
mov edx,0x5000 ; remote port
mov esi,dword [remote_ip] ; node IP
int 0x40
mov [socketNum], eax
call draw_window ; at first, draw the window
still:
mov eax,23 ; wait here for event
mov ebx,1
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:
call draw_window
jmp still
key:
mov eax,2
int 0x40
jmp still
button:
mov eax,17
int 0x40
cmp ah,1 ; button id=1 ?
jnz noclose
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov eax,-1
int 0x40
noclose:
cmp ah,2 ; SEND CODE ?
je send_xcode
 
jmp still
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SEND CODE TO REMOTE ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
send_xcode:
 
mov esi,send_data ; header
mov edi,I_END
mov ecx,end_message-send_data
cld
rep movsb
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socketNum]
mov edx,end_message-send_data
mov esi,I_END
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+250 ; [x start] *65536 + [x size]
mov ecx,60*65536+150 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
mov eax,8 ; SEND MESSAGE
mov ebx,50*65536+145
mov ecx,47*65536+13
mov edx,2
mov esi,0x667788
int 0x40
cld
mov ebx,25*65536+50 ; draw info text with function 4
mov ecx,0x000000
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
text:
db ' ®á« âì á®®¡é¥­¨¥ '
db ' '
db ' ‹®ª «ì­ë©  ¤à¥á : 192.168.0.1 '
db ' “¤ «ñ­­ë©  ¤à¥á : 192.168.0.2 '
db '’¥ªáâ ¨  ¤à¥á ¢ ª®­æ¥ ¨á室­¨ª  '
db 'x <- END MARKER, DONT DELETE '
labeltext: db 'NetSend(Client)' ;
lte:
socketNum dd 0x0
remote_ip db 192,168,1,2
picture_position dd 0x0
send_data db 'à¨¢¥â,íâ® â¥áâ!Hello,this is a test!'
end_message:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/netsends/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm netsends.asm netsends
@pause
/programs/netsends/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm netsends.asm netsends
@pause
/programs/netsends/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/netsends/trunk/netsends.asm
0,0 → 1,207
;
; NetSend(Server)
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
;
; Ž¯¨á ­¨¥:
; à®£à ¬¬  ¤«ï ®¡¬¥­  á®®¡é¥­¨ï¬¨ ¢ á¥â¨.‘¥à¢¥à­ ï ç áâì.
;
; Compile with FASM for Menuet
; Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
;
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'
remote_ip db 192,168,0,1
START: ; start of execution
mov eax, 53 ; open receiver socket
mov ebx, 0
mov ecx, 0x5000 ; local port
mov edx, 0xffff ; remote port
mov esi, dword [remote_ip] ; remote IP
int 0x40
mov [socketNum],eax
mov [0],eax ; save for remote code
call draw_window ; at first, draw the window
still:
mov eax,23 ; wait here for event
mov ebx,1
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
mov eax,53 ; data from cluster terminal ?
mov ebx,2
mov ecx,[socketNum]
int 0x40
cmp eax,0
jne data_arrived
jmp still
red:
call draw_window
jmp still
key:
mov eax,2
int 0x40
jmp still
button:
mov eax,53
mov ebx,1
mov ecx,[socketNum]
int 0x40
mov eax,-1
int 0x40
data_arrived:
mov eax,5 ; wait a second for everything to arrive
mov ebx,10
int 0x40
mov edi,I_END
get_data:
mov eax,53
mov ebx,3
mov ecx,[socketNum]
int 0x40
mov [edi],bl
inc edi
mov eax,53
mov ebx,2
mov ecx,[socketNum]
int 0x40
cmp eax,0
jne get_data
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,I_END
mov esi,100
int 0x40
add [y],10
jmp still
y dd 0x10
; *********************************************
; ******* 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+330 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
mov eax,8
mov ebx,(286-19)*65536+12
mov ecx,4*65536+12
mov edx,1
mov esi,0xaabbcc
; int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
; Re-draw the screen text
cld
mov ebx,10*65536+30 ; draw info text with function 4
mov ecx,0x000000
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
text:
db '„ ­­ë©  ¤à¥á : 192.168.0.2 '
db 'à®á«ã訢 ¥¬ë© ¯®àâ : 0x5000 '
db 'à¨á« ­­ë¥ á®®¡é¥­¨ï: '
db 'x <- END MARKER, DONT DELETE '
labeltext: db 'NetSend(Server)'
lte:
socketNum dd 0x0
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/nntpc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm nntpc.asm nntpc
@pause
/programs/nntpc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm nntpc.asm nntpc
@pause
/programs/nntpc/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/nntpc/trunk/nntpc.asm
0,0 → 1,933
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; NNTP CLIENT v 0.1
;;
;; (C) Ville Turjanmaa
;;
 
version equ '0.1'
 
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 0x80000 ; memory for app
dd 0x80000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
 
connect_state db 0,0,'Disconnected'
db 1,3,'Trying.. '
db 4,4,'Connected '
db 5,9,'Closing.. '
 
prev_state dd -1
 
space dd 0x0
 
text_start dd 0x0
 
text_current dd 0x0
 
status dd 0x0
 
server_ip db 192,168,0,96
 
socket dd 0x0
 
xpos dd 0x0
ypos dd 0x0
 
;;
 
group db 'GROUP alt.test',13,10
db ' '
 
grouplen dd 16
 
stat db 'STAT '
 
statlen dd 0x0
 
article db 'ARTICLE',13,10
articlelen:
 
;;
 
quit db 'QUIT',13,10
quitlen:
 
xwait dd 0x0
ywait dd 0x0
 
article_n dd 0x0
article_l dd 0x0
 
article_start dd 0x0
article_last dd 0x0
article_all dd 0x0
 
article_fetch dd 0x0
 
xpost dd 0x0
 
edisave dd 0x0
 
 
connection_status:
 
pusha
 
mov eax,53
mov ebx,6
mov ecx,[socket]
int 0x40
 
cmp eax,[prev_state]
je no_cos
 
mov [prev_state],eax
 
mov eax,13
mov ebx,435*65536+12*6
mov ecx,42*65536+10
mov edx,0xffffff
int 0x40
 
mov ecx,-14
mov eax,[prev_state]
 
next_test:
 
add ecx,14
 
cmp ecx,14*4
je no_cos
 
cmp al,[connect_state+ecx+0]
jb next_test
cmp al,[connect_state+ecx+1]
jg next_test
 
mov edx,ecx
add edx,2
add edx,connect_state
 
mov eax,4
mov ebx,435*65536+42
mov ecx,0x000000
mov esi,12
int 0x40
 
no_cos:
 
popa
 
ret
 
 
 
text_input:
 
pusha
mov ecx,25
mov eax,32
cld
rep stosb
popa
 
mov [edisave],edi
 
ti0:
 
mov [edi],byte ' '
call draw_entries
 
mov eax,10
int 0x40
 
cmp eax,2
jne no_more_text
 
mov eax,2
int 0x40
 
cmp ah,8
jne no_bg
cmp edi,[edisave]
je ti0
dec edi
jmp ti0
no_bg:
 
cmp ah,13
je no_more_text
 
mov [edi],ah
inc edi
 
call draw_entries
 
jmp ti0
 
no_more_text:
 
mov [xpost],edi
 
ret
 
 
convert_text_to_ip:
 
pusha
 
mov edi,server_ip
mov esi,text+10
mov eax,0
mov edx,[xpost]
newsip:
cmp [esi],byte '.'
je sipn
cmp esi,edx
jge 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,text+50
jg sipnn
inc edi
cmp edi,server_ip+3
jbe newsip
sipnn:
 
popa
 
ret
 
 
send_group:
 
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,[grouplen]
mov esi,group
int 0x40
mov [status],3
call clear_text
call save_coordinates
 
ret
 
 
convert_number_to_text:
 
pusha
 
mov eax,[esi]
mov ecx,0
newch:
inc ecx
xor edx,edx
mov ebx,10
div ebx
cmp eax,0
jne newch
 
add edi,ecx
dec edi
mov [article_l],ecx
 
mov eax,[esi]
newdiv:
xor edx,edx
mov ebx,10
div ebx
add edx,48
mov [edi],dl
dec edi
loop newdiv
 
popa
 
ret
 
 
convert_text_to_number:
 
pusha
 
mov edx,0
newdigit:
movzx eax,byte [esi]
cmp eax,'0'
jb cend
cmp eax,'9'
jg cend
imul edx,10
add edx,eax
sub edx,48
inc esi
jmp newdigit
cend:
mov [edi],edx
popa
 
ret
 
 
clear_text:
 
mov [text_start],0
mov [xpos],0
mov [ypos],0
mov [xwait],0
mov [ywait],0
mov edi,nntp_text
mov ecx,0x50000
mov eax,32
cld
rep stosb
ret
 
 
state_machine_write:
 
 
cmp [status],2
jne no_22
call send_group
ret
no_22:
 
cmp [status],4
jne no_4
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,[statlen] ; -stat
mov esi,stat
int 0x40
mov [status],5
call save_coordinates
ret
no_4:
 
cmp [status],6
jne no_6
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,articlelen-article
mov esi,article
int 0x40
mov [status],7
call save_coordinates
ret
no_6:
 
 
ret
 
save_coordinates:
 
mov eax,[xpos]
mov ebx,[ypos]
mov [xwait],eax
mov [ywait],ebx
 
ret
 
 
state_machine_read:
 
cmp [status],1
jne no_1
mov eax,'200 '
call wait_for_string
ret
no_1:
 
cmp [status],3 ;; responce to group
jne no_3
mov eax,'211 '
call wait_for_string
ret
no_3:
 
cmp [status],5 ;; responce to stat
jne no_5
mov eax,'223 '
call wait_for_string
ret
no_5:
 
;; after 'article' request - no wait
 
cmp [status],9
jne no_9
mov eax,'222 '
call wait_for_string
ret
no_9:
 
 
 
ret
 
 
 
wait_for_string:
 
mov ecx,[ywait]
imul ecx,80
add ecx,[xwait]
 
mov ecx,[nntp_text+ecx]
 
cmp eax,ecx
jne no_match
 
cmp [status],3
jne no_stat_ret
 
mov esi,[ywait]
imul esi,80
add esi,[xwait]
 
new32s:
inc esi
movzx eax,byte [esi+nntp_text]
cmp eax,47
jge new32s
new32s2:
inc esi
movzx eax,byte [esi+nntp_text]
cmp eax,47
jge new32s2
inc esi
add esi,nntp_text
; mov [esi-1],byte '.'
 
mov edi,article_n
call convert_text_to_number
mov eax,[article_n]
mov [article_start],eax
 
new32s3:
inc esi
movzx eax,byte [esi]
cmp eax,47
jge new32s3
inc esi
 
mov edi,article_last
call convert_text_to_number
 
mov eax,[text_current]
add [article_n],eax
 
mov esi,article_n
mov edi,nntp_text+71
call convert_number_to_text
 
mov esi,article_n
mov edi,stat+5
call convert_number_to_text
 
mov eax,[article_l]
mov [stat+5+eax],byte 13
mov [stat+6+eax],byte 10
add eax,5+2
mov [statlen],eax
 
pusha
mov edi,text+10+66*2
mov ecx,25
mov eax,32
cld
rep stosb
mov esi,text_current
mov edi,text+10+66*2
call convert_number_to_text
mov eax,32
mov ecx,20
mov edi,text+10+66*3
cld
rep stosb
mov eax,[article_last]
sub eax,[article_start]
mov [article_all],eax
mov esi,article_all
mov edi,text+10+66*3
call convert_number_to_text
call draw_entries
popa
 
call draw_text
 
no_stat_ret:
 
inc [status]
 
mov eax,5
mov ebx,10
int 0x40
 
call check_for_incoming_data
 
no_match:
 
ret
 
 
 
START: ; start of execution
 
mov eax,40
mov ebx,10000111b
int 0x40
 
call clear_text
 
call draw_window
 
still:
 
call state_machine_write
call state_machine_read
 
mov eax,23 ; wait here for event
mov ebx,5
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
 
call check_for_incoming_data
 
call connection_status
 
jmp still
 
red: ; redraw
call draw_window
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
 
cmp ah,' '
jne no_space
mov eax,[space]
dec eax
add [text_start],eax
call draw_text
jmp still
no_space:
 
cmp ah,177
jne no_plus
inc [text_start]
call draw_text
jmp still
no_plus:
 
cmp ah,178
jne no_minus
cmp [text_start],0
je no_minus
dec [text_start]
call draw_text
jmp still
no_minus:
 
cmp ah,179
jne no_next
inc [text_current]
call send_group
jmp still
no_next:
 
cmp ah,176
jne no_prev
cmp [text_current],0
je still
dec [text_current]
call send_group
jmp still
no_prev:
 
jmp still
 
 
button: ; button
mov eax,17 ; get id
int 0x40
 
shr eax,8
 
cmp eax,11
jne no_11
mov edi,text+10
call text_input
call convert_text_to_ip
jmp still
no_11:
 
cmp eax,12
jne no_12
mov edi,text+66+10
call text_input
mov esi,text+66+10
mov edi,group+6
mov ecx,[xpost]
sub ecx,text+66+10
mov eax,ecx
cld
rep movsb
mov [group+6+eax],byte 13
mov [group+7+eax],byte 10
add eax,6+2
mov [grouplen],eax
mov [text_current],0
jmp still
no_12:
 
cmp eax,13
jne no_13
mov edi,text+10+66*2
call text_input
mov esi,text+10+66*2
mov edi,text_current
call convert_text_to_number
call send_group
jmp still
no_13:
 
 
cmp eax,14
jne no_start
call clear_text
mov eax,3
int 0x40
mov ecx,eax
mov eax,53
mov ebx,5
mov edx,119
mov esi,dword [server_ip]
mov edi,1
int 0x40
mov [socket],eax
mov [status],1
jmp still
no_start:
 
cmp eax,15
jne no_end
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,quitlen-quit
mov esi,quit
int 0x40
mov eax,5
mov ebx,10
int 0x40
call check_for_incoming_data
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
mov eax,5
mov ebx,5
int 0x40
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
mov [status],0
jmp still
no_end:
 
cmp eax,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
 
jmp still
 
 
check_for_incoming_data:
 
cmp [status],0
jne go_on
ret
go_on:
 
mov eax,53
mov ebx,2
mov ecx,[socket]
int 0x40
 
cmp eax,0
je ch_ret
 
mov eax,53
mov ebx,3
mov ecx,[socket]
int 0x40
 
and ebx,0xff
 
cmp ebx,13
jb no_print
 
cmp bl,13
jne char
mov [xpos],0
inc [ypos]
jmp no_print
char:
 
cmp ebx,128
jbe char_ok
mov ebx,'?'
char_ok:
 
mov ecx,[ypos]
imul ecx,80
add ecx,[xpos]
mov [nntp_text+ecx],bl
cmp [xpos],78
jg noxinc
inc [xpos]
noxinc:
 
no_print:
 
mov eax,53
mov ebx,2
mov ecx,[socket]
int 0x40
 
cmp eax,0
jne check_for_incoming_data
 
call draw_text
 
ch_ret:
 
ret
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
pusha
 
mov [prev_state],-1
 
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+520 ; [x start] *65536 + [x size]
mov ecx,5*65536+470 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; 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
int 0x40
 
mov eax,38
mov ebx,5*65536+515
mov ecx,101*65536+101
mov edx,0x99bbff
int 0x40
mov eax,38
mov ebx,5*65536+515
mov ecx,102*65536+102
mov edx,0x3366aa
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,8
mov ebx,238*65536+8
mov ecx,30*65536+8
mov edx,11
mov esi,0x88aadd
int 0x40
mov eax,8
mov ebx,238*65536+8
mov ecx,41*65536+8
mov edx,12
int 0x40
mov eax,8
mov ebx,238*65536+8
mov ecx,52*65536+8
mov edx,13
int 0x40
 
mov eax,8
mov ebx,265*65536+75
mov ecx,39*65536+13
mov edx,14
int 0x40
mov eax,8
mov ebx,351*65536+75
mov ecx,39*65536+13
mov edx,15
int 0x40
 
call draw_entries
 
call draw_text
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
popa
 
ret
 
 
draw_entries:
 
pusha
 
mov eax,13
mov ebx,30*65536+200
mov ecx,30*65536+44
mov edx,0xffffff
int 0x40
 
mov ebx,30*65536+31 ; draw info text with function 4
mov ecx,0x000000
mov edx,text
mov esi,66
mov edi,6
 
newline2:
 
mov eax,4
int 0x40
add ebx,11
add edx,66
dec edi
jnz newline2
 
popa
 
ret
 
 
draw_text:
 
pusha
 
mov eax,9
mov ebx,0x70000
mov ecx,-1
int 0x40
 
mov eax,[0x70000+46]
cmp eax,150
jbe dtret
 
sub eax,111
mov ebx,10
xor edx,edx
div ebx
mov edi,eax
dec edi
 
mov [space],edi
 
mov ebx,20*65536+111 ; draw info text with function 4
mov ecx,0x000000
mov edx,[text_start]
imul edx,80
add edx,nntp_text
mov esi,80
newline:
 
pusha
mov ecx,ebx
shl ecx,16
mov eax,13
mov ebx,20*65536+80*6
mov cx,10
mov edx,0xffffff
int 0x40
popa
 
mov eax,4
int 0x40
add ebx,10
add edx,80
dec edi
jnz newline
 
dtret:
 
popa
 
ret
 
 
; DATA AREA
 
text:
db 'NNTP IP : 192.168.0.96 < '
db 'Group : alt.test < Connect Disconnect '
db 'Article : 0 < '
db 'Art.max : ? '
db ' '
db 'Arrow left/rigth: fetch prev/next - Arrow up/down & space: scroll '
 
textl:
 
 
labelt:
db 'NNTP client v',version
labellen:
 
nntp_text:
 
db 'a'
 
I_END: ;;;
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/panel/trunk/@PANEL.ASM
0,0 → 1,1945
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; MENUBAR for MenuetOS - Compile with fasm ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; required OS version
dd START ; program start
dd I_END ; program image size
dd 0xB000 ; reguired amount of memory - 64 Kb
dd 0xA000 ; esp
dd 0x0,0x0 ; param, icon
 
include 'lang.inc'
include 'macros.inc'
 
width dd 305
buttons dd 1 ; 0 no frames ; 1 frames
soften_up dd 1 ; 0 no ; 1 yes
soften_down dd 0 ; 0 no ; 1 yes
minimize_left dd 1
minimize_right dd 1
icons_position dd 95
menu_enable dd 1
setup_enable dd 0
graph_text dd 1
soften_middle dd 1 ; 0 no ; 1 yes
icons dd 1 ; 0 defaults ; 1 activate
 
dat db 'PANEL DAT'
 
 
;mainalive db 1
 
;correct_display:
; mov eax,15
; mov ebx,3
; int 0x40
; mcall 5, 300
; jmp correct_display
 
chlangproc:
; mcall 18, 7
; mov [my_process],eax
begin_2:
mcall 40,0b ; 0
begin:
.begin:
mcall 5, eax
begin_3:
mcall 18, 7
mov [active_process],eax
; cmp [mainalive], 0
; je .exit
 
mcall 66, 3
mov ah,al
and al,100000b
cmp al,100000b
je change_start_end
mov al,ah
and al,10000b
cmp al,10000b
je change_start_end
mov al,ah
and al,1000b
cmp al,1000b
je change_key_lang_1
mov al,ah
and al,100b
cmp al,100b
je change_key_lang_1
mov al,ah
and al,1111b
cmp al,11b
jne begin
mcall 19, file_sys, syslang
call syslang_music
; mcall 5, 25
begin_1:
mov ecx,[active_process]
mcall 18, 3
mcall 5, 25
jmp begin
change_key_lang_1:
mov al,ah
and al,11b
cmp al,01b
je change_key_lang
cmp al,10b
jne begin
change_key_lang:
mcall 19, file_sys, chlang
call chlang_music
; mcall 5, 25
jmp begin_1
change_start_end:
mov al,ah
and al,1100b
cmp al,1000b
je start_end
cmp al,100b
jne start_menu
start_end:
; mov ecx,[my_process]
; mcall 18, 3
mcall 18,12
cmp al,1
je scan_codes
cmp ah,255
jne begin
start_end_application:
mcall 19,file_end,0
mcall 5 ,50
jmp begin
scan_codes:
cmp ah,88
je start_end_application
jmp begin
start_menu:
mcall 18,12
mov [button_presssed_alt],eax
; mov ecx,eax
; mcall 47,0x40100, ,10 shl 16+5,0
; mov eax,ecx
cmp al,1
je scan_codes2
cmp ah,72 ;232
je start_menu_application
cmp ah,73 ;233
je start_menu_application
cmp ah,0x35 ;b6 ;53
je kill_active_application
cmp ah,0x9
jne begin
jmp begin
 
kill_active_application:
mcall 18, 7
mov ecx,eax
; mcall 9, area9
; mov eax,area9
; mov ecx,[eax+4]
mcall 18, 2
jmp begin
start_menu_application:
mcall 19,filename,0
call menu_music
mcall 5,50
jmp begin
scan_codes2:
cmp ah,91
je start_menu_application
cmp ah,92
je start_menu_application
cmp ah,83 ;62
je kill_active_application
jmp begin
 
button_presssed_alt dd 0
 
active_process dd 0
my_process dd 0
 
calendar_music:
mcall 55, eax, , , calendarmusic
ret
setup_music:
mcall 55,eax, , ,setupmusic
ret
sysmeter_music:
mcall 55,eax, , ,sysmetermusic
ret
button_music:
mcall 55,eax, , ,buttonmusic
ret
syslang_music:
mcall 55, eax, , , syslangmusic
ret
chlang_music:
mcall 55, eax, , , chlangmusic
ret
menu_music:
mcall 55,eax, , ,menumusic
ret
 
chlangmusic: db 0x82,0x60,0x83,0x65,0x82,0x60,0
 
syslangmusic: db 0x82,0x65,0x83,0x70,0x82,0x65,0
 
menumusic: db 0x82,0x50,0x84,0x48,0x82,0x50,0x84,0x53,0x82,0x51,0
 
activatemusic: db 0x83,0x30,0x85,0x60,0
 
buttonmusic: db 0x85,0x25,0x85,0x40,0
 
sysmetermusic: db 0x85,0x35,0x85,0x45,0
 
setupmusic: db 0x85,0x40,0x85,0x50,0
 
calendarmusic: db 0x85,0x37,0x85,0x48,0
 
; .exit: mcall -1
 
 
START:
mov eax, 6
mov ebx, dat
mov ecx, 0
mov edx, -1
mov esi, I_END
int 0x40
 
mov eax,40
mov ebx,0101b
int 0x40
 
mov edi,width
mov esi,I_END
mov eax,0
new_number:
cmp [esi],byte ';'
je number_ready
imul eax,10
movzx ebx,byte [esi]
sub ebx,'0'
add eax,ebx
inc esi
jmp new_number
number_ready:
mov [edi],eax
mov eax,0
add edi,4
inc esi
cmp [esi],byte 'x'
jne new_number
 
 
call set_variables
 
mcall 51, 1, chlangproc, 0xB000
; mcall 5, 5
; mcall 51, 1, correct_display, 0xA800
 
start_after_minimize:
 
call draw_window
call draw_info
call draw_running_applications
 
mov eax, 23
mov ebx, 30
int 0x40
 
still:
; mcall 13,<390,70>,<3,11>,0xffffff
; mov ecx,[button_presssed_alt]
; mcall 47,0x80100,ecx ,400 shl 16+5,0
 
call draw_info
call draw_running_applications
 
mov eax, 23
mov ebx, 20
int 0x40
 
cmp eax,1 ; redraw ?
jz red
cmp eax,3 ; button ?
jz button
 
jmp still
 
red: ; redraw window
call draw_window
call draw_info
jmp still
 
button: ; button
mov eax,17
int 0x40
 
cmp ah,50
jb no_activate
cmp ah,70
jg no_activate
 
movzx ecx,byte ah
sub ecx,52
shl ecx,2
 
mov eax,18
mov ebx,3
mov ecx,[app_list+ecx]
int 0x40
; cmp [music_type],0
; je still
mcall 55,eax, , ,activatemusic
jmp still
no_activate:
 
 
cmp ah,101 ; minimize to left
je left_button
 
cmp ah,102 ; minimize to right
je right_button
 
cmp ah,byte 1 ; start/terminate menu
jnz noselect
call menu_handler
; cmp [music_type],0
; je still
call menu_music
jmp still
noselect:
 
cmp ah,byte 2 ; start calendar
jnz noid15 ;noclock
mov eax, 19
mov ebx, file6
xor ecx, ecx
int 0x40
call calendar_music
jmp still
; noclock:
 
; cmp ah,byte 11 ; start file 1
; jnz nob1
; mov eax,19
; mov ebx,file1
; int 0x40
; jmp still
; nob1:
 
; cmp ah,byte 12 ; start file 2
; jnz nob2
; mov eax,19
; mov ebx,file2
; int 0x40
; jmp still
; nob2:
 
; cmp ah,byte 13 ; start file 3
; jnz nob3
; mov eax,19
; mov ebx,file3
; int 0x40
; jmp still
; nob3:
 
; cmp ah,14 ; start file 4
; jne noid14
; mov eax,19
; mov ebx,file4
; mov ecx,file4_par
; int 0x40
; jmp still
; noid14:
 
; cmp ah,15 ; start file 5
; jne noid15
; mov eax,19
; mov ebx,file5
; int 0x40
; jmp still
 
noid15:
cmp ah,16
jne noid16
mcall 19, file_sys, chlang
call chlang_music
mcall 5, 25
jmp still
 
noid16:
cmp ah,17
jne noid17
mcall 19, file_sys, syslang
call syslang_music
mcall 5, 25
jmp still
 
noid17:
cmp ah,18
jne noid18
mcall 19, sysmeter, 0
call sysmeter_music
jmp still
 
noid18:
cmp ah,19
jne noid19
; inc [music_type]
; and [music_type],1
mcall 18,8,2
; mcall 18,8
; mov [sound_flag],al
 
; mcall 15,4,2
mcall 15,3
jmp red
 
noid19:
cmp ah,20 ; start system setup
jnz noid20
mov eax, 19
mov ebx, file_sys
xor ecx, ecx
int 0x40
call setup_music
 
noid20:
 
jmp still
 
 
 
draw_running_applications:
 
pusha
 
cmp [icons],1
jne dr_ret
 
call calculate_applications
 
cmp edi,[running_applications]
jne noret
popa
ret
noret:
 
; cmp edi,[running_applications]
; jge no_application_decrease
call draw_window
; no_application_decrease:
 
mov [running_applications],edi
 
mov edi,0
mov ecx,2
mov [contrast],0
 
newpr:
 
mov eax,9
mov ebx,0x8000
int 0x40
 
push eax
push ecx
 
cmp eax,ecx
jb norpl2
 
cmp byte [0x8000+10], '@'
je norpl
cmp [0x8000+11],dword 'CON '
je norpl
cmp [0x8000+11],dword 'ENU '
je norpl
; cmp [0x8000+12],dword 'NEL '
; je norpl
cmp [0x8000+10],dword ' '
je norpl
 
mov eax,13
mov ebx,edi
inc ebx
shl ebx,16
imul ebx,6*10
add ebx,17 shl 16+54
mov ecx,3 shl 16+14
xor edx,edx
sub ebx,10 shl 16
int 0x40
 
sub ebx,1 shl 16
mov bx,1
mov ecx,4 shl 16+12
int 0x40
 
sub ebx,1 shl 16
mov ecx,5 shl 16+10
int 0x40
 
add ebx,56 shl 16
mov ecx,4 shl 16+12
int 0x40
 
add ebx,1 shl 16
mov ecx,5 shl 16+10
int 0x40
 
inc [contrast]
and [contrast],1
cmp [contrast],1
je contrast1
mov edx,0x88ff
jmp contrast2
contrast1:
mov edx,0x55ff
contrast2:
sub ebx,55 shl 16
mov bx,54
mov ecx,4 shl 16+12
; mov edx,0x66ff
int 0x40
 
sub ebx,1 shl 16
mov bx,1
mov ecx,5 shl 16+10
int 0x40
 
add ebx,55 shl 16
int 0x40
 
mov eax,4
mov ebx,edi
inc ebx
shl ebx,16
imul ebx,6*10 ;13
add ebx,20*65536+7
mov ecx,0xffffff ;[wcolor]
; add ecx,0x303030
mov edx,0x8000+10
mov esi,11
sub ebx,10 shl 16
int 0x40
 
norpl2:
 
inc edi
 
norpl:
 
pop ecx
pop eax
 
inc ecx
 
cmp edi,[max_applications]
jb newpr
 
nompr:
 
dr_ret:
 
popa
 
ret
 
 
calculate_applications:
 
mov edi,app_list
mov ecx,20
mov eax,0xff
cld
rep stosd
 
mov edi,0
mov ecx,2
 
cnewpr:
 
mov eax,9
mov ebx,0x8000
int 0x40
 
cmp byte [0x8000+10], '@'
je cnorpl
cmp [0x8000+11],dword 'CON '
je cnorpl
cmp [0x8000+11],dword 'ENU '
je cnorpl
; cmp [0x8000+12],dword 'NEL '
; je cnorpl
cmp [0x8000+10],dword ' '
je cnorpl
 
mov [app_list+edi*4],ecx
 
inc edi
 
cnorpl:
inc ecx
 
cmp eax,ecx
jge cnewpr
 
ret
 
 
draw_application_buttons:
 
pusha
 
cmp [icons],1
jne da_ret
 
mov eax,14
int 0x40
 
shr eax,16
 
cmp eax,639
jne now1
mov [max_applications],7 ;6
now1:
cmp eax,799
jne now2
mov [max_applications],10 ;8
now2:
cmp eax,1023
jne now3
mov [max_applications],13 ;8
now3:
cmp eax,1279
jne now4
mov [max_applications],18 ;8
now4:
mov edi,1
 
nb:
 
mov eax,8
mov ebx,edi
shl ebx,16
imul ebx,6*10 ;13
add ebx,15*65536+10*6-1 ;13
mov ecx,1*65536+17
mov edx,edi
add edx,51
cmp [buttons],1
je bufr
or edx,0x60000000
bufr:
mov esi,[wcolor]
sub ebx,11 shl 16
int 0x40
 
inc edi
cmp edi,[max_applications]
jbe nb
 
da_ret:
 
popa
 
ret
 
 
menu_handler:
mov eax, 19
mov ebx, filename
xor ecx, ecx
int 0x40
ret
 
draw_small_right:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0
mov edx,[wcolor]
mov esi,edx
mov edi,edx
or edx, 0x01000000
int 0x40
 
mov eax,8
mov ebx,0*65536+9
mov ecx,0*65536
mov cx,[b_size_y]
mov edx,1
mov esi,[wcolor]
int 0x40
 
mov eax,4
mov ebx,2*65536+16
cmp [graph_text],1
jne nos3
mov ebx,2*65536+7
nos3:
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext
mov esi,1
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
popa
 
ret
 
 
 
draw_small_left:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0
mov edx,[wcolor]
mov esi,edx
mov edi,edx
or edx, 0x01000000
int 0x40
 
cmp [graph_text],1
je nos4
 
mov eax,8
mov ebx,0*65536+9
mov ecx,0*65536+18-6
mov edx,2
mov esi,[wcolor]
int 0x40
 
mov eax,4
mov ebx,2*65536+4
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext+2
mov esi,1
int 0x40
 
nos4:
 
mov eax,8
mov ebx,0*65536+9
mov ecx,13*65536+25
cmp [graph_text],1
jne nos6
mov ecx,0*65536
mov cx,word [b_size_y]
nos6:
mov edx,1
mov esi,[wcolor]
int 0x40
 
mov eax,4
mov ebx,3*65536+22
cmp [graph_text],1
jne nos7
mov ebx,3*65536+7
nos7:
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext+1
mov esi,1
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
;-------------------------------------------------
 
right_button:
 
call button_music
 
mov [small_draw],dword draw_small_right
 
mcall 14
shr eax, 16
mov ebx, eax
mov ecx, -1
mov edx, 9
sub ebx, edx
mov esi, -1
mcall 67
 
call draw_small_right
 
mov eax, 23
mov ebx, 30
int 0x40
 
jmp small_wait
 
;-------------------------------------------------
 
left_button:
 
call button_music
 
mov [small_draw],dword draw_small_left
 
mov ebx, 0
mov edx, 9
mov ecx, -1
mov esi, -1
mcall 67
 
call draw_small_left
 
mov eax, 23
mov ebx, 30
int 0x40
 
;-------------------------------------------------
 
small_wait:
 
mov eax, 10
int 0x40
 
cmp eax,1
jne no_win
call [small_draw]
jmp small_wait
no_win:
 
mov eax,17
int 0x40
 
cmp ah,1
jne no_full
 
mov eax, 14 ; get screen max x & max y
int 0x40
mov edx, eax
shr edx, 16
mov ebx, -1
mov ecx, -1
mov esi, -1
mcall 67 ; x0 y0 xs ys
 
call button_music
 
jmp still
 
 
no_full:
 
call menu_handler
 
jmp small_wait
 
 
 
set_variables:
 
pusha
 
mov [b_size_y],dword 38
cmp [graph_text],1
jne noy2
mov [b_size_y],dword 18
noy2:
 
mov [button_frames],0x0
cmp [buttons],0
jne no_frames
mov [button_frames],0x40000000
no_frames:
 
 
mov eax,48 ; 3d button look
mov ebx,1
mov ecx,1
int 0x40
 
mov eax,0x40404040 ; dividers for processes
mov edi,pros
mov ecx,10
cld
rep stosd
 
popa
ret
 
 
 
; eax = number (1 or 2)
; ebx = language id
draw_flag:
pusha
 
; cmp [graph_text],0
; je mini_flag
 
; eax = 2 BIG
; eax = 1 small
 
mov edx,ebx
 
mov ebx,[maxx]
and eax,1
imul eax,17 ;17
sub ebx,eax
sub ebx,76 ;79 ;28
 
pushad
; dec ebx
sub ebx,2
shl ebx, 16
add ebx, 15 ;25
mov ecx, 4*65536+13
mov edx,0
mov eax,13
int 0x40
add ebx,1 shl 16
sub ebx,2
mov ecx, 5 shl 16+11
cmp [type_lang],1
je label_1
mov edx,0xff ;[wcolor]
jmp label_2
label_1:
mov edx,0x7700
label_2:
mov eax, 13
int 0x40
popad
 
shl ebx,16
add ebx,7 ;24
 
mov ecx,[bte] ; color
 
dec edx
shl edx,1
add edx,flag_text
mov esi,2
mov eax,4
int 0x40
 
mov ebx,[maxx]
sub ebx,48
shl ebx,16
mov bx,34
mov ecx,3 shl 16+14
xor edx,edx
mov eax,13
int 0x40
add ebx,1 shl 16
sub ebx,2
mov ecx,4 shl 16+12
mov edx,0x66cc
int 0x40
 
popa
ret
 
;mini_flag:
; popa
; ret
 
 
 
 
; ***************************************************
; ********* WINDOW DEFINITIONS AND DRAW *************
; ***************************************************
 
 
draw_window:
 
pusha
 
mov [running_applications],-1
mov [checks],-1
 
mov eax, 12 ; tell os about redraw
mov ebx, 1
int 0x40
 
mov eax, 48
mov ebx, 3
mov ecx, system_colours
mov edx, 10*4
int 0x40
 
mov eax, [system_colours+4*6]
mov [wcolor], eax
 
mov eax,14 ; get screen max x & max y
int 0x40
 
cmp [width],0
je no_def_width
and eax,0xffff
mov ebx,[width]
shl ebx,16
add eax,ebx
no_def_width:
 
mov ebx,eax
mov [screenxy],ebx
shr ebx,16
sub ax,38
shl eax,16
mov ecx,eax
add ecx,0*65536+38
cmp [graph_text],1
jne no_text_1
mov cx,18
add ecx,20*65536
no_text_1:
mov eax, 0 ; DEFINE AND DRAW WINDOW
mov edx, [wcolor]
or edx, 0x01000000 ; do not draw the window
mov esi, [wcolor]
or esi, 0x01000000 ; unmovable window
mov edi, [wcolor]
int 0x40
 
movzx ebx,word [screenxy+2]
mov ecx,0*65536+0
mov edx,[wcolor]
add edx,0x161616
newline:
sub edx,0x040404
mov eax,38
cmp [soften_up],1
jne no_su
int 0x40
no_su:
 
pusha
cmp [soften_down],1
jne no_sd
sub edx,0x141414
mov edi,[b_size_y]
shl edi,16
add edi,[b_size_y]
add ecx,edi
sub ecx,3*65536+3
int 0x40
no_sd:
popa
 
add ecx,1*65536+1
cmp cx,5
jb newline
 
cmp [soften_middle],1
jne no_sm
 
movzx ebx,word [screenxy+2]
mov ecx,5*65536+5
mov esi,stripe
mov edx,[wcolor]
newline3:
add edx,[esi]
add esi,4
 
mov eax,38
int 0x40
add ecx,1*65536+1
cmp cx,15
jb newline3
 
no_sm:
 
cmp [minimize_left],1
jne no_mleft
mov eax,8 ; ABS LEFT
mov ebx,0 *65536+9
mov ecx,1 *65536
add ecx,[b_size_y]
dec ecx
mov edx,101
add edx,[button_frames]
mov esi,[wcolor]
int 0x40
mov eax,4 ; HIDE TEXT
mov ebx,2*65536+17
cmp [graph_text],1
jne no_y1
mov bx,7
no_y1:
mov ecx,[wcolor]
add ecx,0x303030
mov edx,hidetext
mov esi,1
int 0x40
no_mleft:
 
movzx eax,word [screenxy+2]
mov [maxx],eax
 
cmp [minimize_right],1
jne no_mright
mov eax,[maxx]
sub eax,77
shl eax,16
mov ebx,eax
add ebx,67
mov eax,8 ; ABS RIGHT
mov ecx,1 *65536
add ecx,[b_size_y]
dec ecx
add ebx,68*65536
mov bx,9
mov edx,102
add edx,[button_frames]
mov esi,[wcolor]
int 0x40
mov edx,hidetext+1
mov eax,4
mov ebx,[maxx]
sub ebx,6
shl ebx,16
mov bx,17
cmp [graph_text],1
jne no_y2
mov bx,7
no_y2:
mov ecx,[wcolor]
add ecx,0x303030
mov esi,1
int 0x40
no_mright:
 
call draw_menuet_icon
 
call draw_program_icons
 
mov [ptime],0
call draw_info
 
call draw_application_buttons
 
; mov ecx,[button_presssed_alt]
; mcall 47,0x80100,ecx ,400 shl 16+5,0
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
 
draw_menuet_icon:
 
pusha
 
cmp [menu_enable],1
jne no_menu
 
 
mov eax, 8 ; M BUTTON
mov ebx, 10*65536 + 47
cmp [minimize_left], 0
jne @f
sub ebx, 10*65536
@@:
mov ecx, 1*65536
add ecx, [b_size_y]
dec ecx
mov edx, 0x20000001
add edx, [button_frames]
mov esi, [wcolor]
int 0x40
 
cmp [graph_text], 1
jne no_mtext
 
push ebx
mov eax,13
mov ebx,12 shl 16+44 ;51
mov ecx,1 shl 16+17
xor edx,edx
int 0x40
; mov ebx,63 shl 16+1
mov ebx,56 shl 16+1
mov ecx,2 shl 16+15
int 0x40
mov ebx,57 shl 16+1
mov ecx,4 shl 16+11
int 0x40
mov ebx,58 shl 16+1
mov ecx,6 shl 16+7
int 0x40
; mov ebx,66 shl 16+1
; mov ecx,9 shl 16+1
; int 0x40
mov ebx,13 shl 16+43 ;50
mov ecx,2 shl 16+15
mov edx,0x7700
int 0x40
; mov ebx,62 shl 16+1
; mov ecx,3 shl 16+14
; int 0x40
mov ebx,56 shl 16+1
mov ecx,4 shl 16+11
int 0x40
mov ebx,57 shl 16+1
mov ecx,6 shl 16+7
int 0x40
pop ebx
 
mov eax, 4
mov bx, 7
add ebx, 8*65536
mov ecx, 0x10ffffff
mov edx, m_text
mov esi, 4
int 0x40
 
popa
ret
 
no_mtext:
 
 
 
mov eax,[wcolor]
mov [m_icon+4],eax
 
mov eax,6 ; load file
mov ebx,m_bmp
mov ecx,0
mov edx,200000
mov esi,image
mov edi,0
int 0x40
 
mov eax,40
mov ebx,0
mov edi,image+53
 
new_m_pix:
 
; movzx ecx,byte [edi]
; shr ecx,5
 
mov cl,[edi]
cmp cl,10
jb nopix
mov cl,[edi+1]
cmp cl,10
jb nopix
mov cl,[edi+2]
cmp cl,10
jb nopix
 
pusha
cmp [minimize_left],0
jne no_m_s2
sub ebx,10
no_m_s2:
; mov edx,[ecx*4+m_icon]
mov edx,[edi+1]
 
mov ecx,eax
mov eax,1
add ebx,12
int 0x40
popa
 
nopix:
 
add edi,3
add ebx,1
cmp ebx,40
jnz new_m_pix
 
mov ebx,0
dec eax
jnz new_m_pix
 
no_menu:
 
popa
ret
 
 
draw_program_icons:
 
pusha
 
cmp [icons],0
jne dp_ret
 
mov edi,1
push edi
 
new_icon_file:
 
pusha
mov edx,[esp+32]
add edx,10
push edx
mov esi,[wcolor]
mov ecx,1*65536
add ecx,[b_size_y]
dec ecx
mov eax,edi
dec eax
imul eax,40
mov ebx,eax
add ebx,[icons_position]
shl ebx,16
mov bx,39
pop edx
add edx,[button_frames]
or edx, 0x20000000
mov eax,8
int 0x40
popa
 
mov ecx,[esp]
add ecx,48
mov [iconf+6],cl
 
mov eax,6 ; load file
mov ebx,iconf
mov ecx,0
mov edx,200000
mov esi,image
int 0x40
 
mov eax,0
mov ebx,32
mov edi,image+51+32*33*3
 
np2: ; new pixel of file
 
mov edx,[edi]
and edx,0xffffff
 
cmp eax,3 ; Y draw limits
jb nopix2
cmp eax,36
jg nopix2
cmp ebx,38 ; X draw limits
jg nopix2
cmp ebx,2
jb nopix2
 
cmp edx,0
jz nopix2
 
cmp [graph_text],1
jne no_icon_text
 
pusha
 
mov ebx,[esp+32]
dec ebx
imul ebx,40
add ebx,8
add ebx,[icons_position]
shl ebx,16
mov bx,7
 
mov eax,4
mov ecx,0xffffff
mov edx,[esp+32]
dec edx
imul edx,4
add edx,mi_text
mov esi,4
int 0x40
 
popa
 
jmp nopix2
 
no_icon_text:
 
mov esi,[esp]
pusha
push edx
mov ecx,eax
add ecx,2
mov eax,esi
dec eax
imul eax,40
add ebx,eax
add ebx,3
add ebx,[icons_position]
pop edx
mov eax,1
int 0x40
popa
 
nopix2:
 
sub edi,3
dec ebx
jnz np2
 
mov ebx,32
add eax,1
cmp eax,32
jnz np2
 
add dword [esp],1
mov edi,[esp]
cmp dword [esp],4
jbe new_icon_file
add esp,4
 
mov eax,4
mov ebx,40
imul ebx,3
add ebx,[icons_position]
add ebx,10
shl ebx,16
mov bx,23
mov ecx,[wcolor]
mov edx,gpl
mov esi,3
int 0x40
 
dp_ret:
 
popa
ret
 
 
 
draw_info: ; draw cpu usage, time, date
 
pusha
 
cmp [setup_enable],1
jne no_setup
 
cmp [minimize_right],0
jne no_m_r
add [maxx],10
 
no_m_r:
 
mov eax,3
int 0x40
cmp eax,[ptime]
jz _ret
mov [ptime],eax
 
call draw_cpu_usage
 
mov eax,[maxx] ; blink sec
sub eax,33
shl eax,16
mov ebx,eax
add ebx,9
mov eax,3
int 0x40
cmp [graph_text],1
jne no_y4
sub bx,2
no_y4:
mov ecx,eax
shr ecx,16
and ecx,1
mov edx,[bte]
sub edx,[wcolor]
imul ecx,edx
add ecx,[wcolor]
mov edx,sec
mov eax,4
mov esi,1
int 0x40
 
 
mov eax,26 ; check for change in time or country
mov ebx,5
int 0x40
mov edx,eax
mov eax,26
mov ebx,2
mov ecx,9
int 0x40
add edx,eax
mov eax,3
int 0x40
and eax,0xffff
add edx,eax
cmp edx,[checks]
je _ret
mov [checks],edx
 
mov ebx,[maxx]
sub ebx,48 ;;94 ;;74
shl ebx,16
add ebx,33 ;;84 ;;64
 
mov eax,8 ; time/date button
mov ecx,3 *65536
add ecx,[b_size_y]
; dec ecx
sub cx,5
mov edx,2+0x20000000
mov esi,[wcolor]
int 0x40
pusha
mov eax,13
add ebx,10*65536-16
add ecx,5*65536-8
mov edx,[wcolor]
int 0x40
popa
and edx,0xffff
add edx,[button_frames]
int 0x40
 
mov eax,8
mov ebx,[maxx]
sub ebx,77 ;80
shl ebx,16
add ebx,12
mov ecx,5 shl 16+10
mov edx,16+0x20000000 ;button 16
mov esi,[wcolor]
int 0x40
sub ebx,17 shl 16
inc edx ;button 17
int 0x40
add ebx,33 shl 16
mov bx,8
inc edx ;button 18
int 0x40
sub ebx,47 shl 16
mov bx,10
inc edx ;button 19
int 0x40
sub ebx,14 shl 16
inc edx ;button 20
int 0x40
; flags
 
mov eax,26
mov ebx,5
int 0x40
mov ebx,eax
 
mov eax,1
mov [type_lang],al
call draw_flag
 
mov eax,26
mov ebx,2
mov ecx,9
int 0x40
mov ebx,eax
 
mov eax,2
mov [type_lang],al
call draw_flag
 
mcall 18,8,1
mov [sound_flag],al
 
mov ebx,[maxx]
sub ebx,109 ;112 ;28
shl ebx,16
mov bx,12
mov ecx, 4*65536+13
mov edx,0
mov eax,13
int 0x40
add ebx,1 shl 16
sub bx,2
mov ecx,5 shl 16+11
mov edx,0xcc
int 0x40
add ebx,1 shl 16
mov bx,5
mov ecx,8 shl 16+5
mov edx,0xdddd00
int 0x40
add ebx,5 shl 16
mov bx,1
mov ecx,7 shl 16+7
int 0x40
add ebx,1 shl 16
mov ecx,6 shl 16+9
int 0x40
add ebx,1 shl 16
mov ecx,5 shl 16+11
int 0x40
 
; cmp [music_type],0
; jne dalshe
cmp [sound_flag],0
je dalshe
 
sub ebx,8 shl 16
ror ebx,16
mov cx,bx
rol ebx,16
mov bx,cx
add bx,8
mov ecx,5 shl 16+15
mov edx,0xff0000
mov eax,38
int 0x40
add ebx,1 shl 16
inc bx
int 0x40
rol ecx,16
int 0x40
sub ebx,1 shl 16
dec bx
int 0x40
 
dalshe:
 
mov ebx,[maxx]
sub ebx,123
shl ebx,16
mov bx,12
mov ecx, 4*65536+13
mov edx,0
mov eax,13
int 0x40
add ebx,1 shl 16
sub bx,2
mov ecx,5 shl 16+11
mov edx,0xffcc00
int 0x40
mov eax,4
mov ebx,[maxx]
sub ebx,121
shl ebx,16
mov bx,7
mov ecx,0x10000000
mov edx,file_sys
mov esi,1
int 0x40
add ebx,1 shl 16
int 0x40
 
; sub ebx,14 shl 16
; mov bx,7
; mov edx,turn_text
; mov esi,1
 
; mov ecx,0x60a060 ;[wcolor]
; add ecx,0x303030
; mov eax,4
; int 0x40
; add ebx,1 shl 16
; int 0x40
; add ebx,1 shl 16
; int 0x40
; add ebx,1 shl 16
; int 0x40
 
; add ebx,1 shl 16
; mov ecx,0x60a060 ;[wcolor]
; int 0x40
; add ebx,1 shl 16
; int 0x40
; add ebx,1 shl 16
; sub ecx,0x303030
; int 0x40
 
; sub ebx,6 shl 16
; mov bx,1
; mov ecx,2 shl 16+15
; mov edx,0x60a060 ;[wcolor]
; add edx,0x303030
; mov eax,13
; int 0x40
; add ebx,1 shl 16
; mov bx,1
; mov edx,0x60a060 ;[wcolor]
; int 0x40
; add ebx,1 shl 16
; mov bx,1
; sub edx,0x303030
; int 0x40
; add ebx,1 shl 16
; mov edx,[wcolor]
; int 0x40
 
mov eax,3 ; get time
int 0x40
 
movzx ebx,al
shr eax,8
movzx ecx,al
shr eax,8
movzx edx,al
 
; ebx ecx edx h m s
 
push ebx
push ecx
 
mov eax,[maxx]
sub eax,32
shl eax,16
mov ebx,eax
add ebx,9
 
mov ecx,[bte]
 
cmp [graph_text],1
jne no_y3
sub bx,2
mov ecx,0xffffff
no_y3:
 
 
mov edx,[esp] ; __:_X
and edx,15
mov eax,4
add ebx,10*65536
add edx,text
mov esi,1
int 0x40
 
pop edx ; __:X_
shr edx,4
and edx,15
mov eax,4
sub ebx,6*65536
add edx,text
mov esi,1
int 0x40
 
mov edx,[esp] ; _X:__
and edx,15
mov eax,4
sub ebx,11*65536
add edx,text
mov esi,1
int 0x40
 
pop edx ; X_:__
shr edx,4
and edx,15
mov eax,4
sub ebx,6*65536
add edx,text
mov esi,1
int 0x40
 
call draw_cpu_usage
 
_ret:
 
cmp [minimize_right],0
jne no_m_r2
sub [maxx],10
no_m_r2:
 
no_setup:
 
popa
ret
 
 
 
draw_cpu_usage:
 
pusha
 
mov [ysi],30
cmp [graph_text],1
jne @f
mov [ysi],10
@@:
 
 
mov eax,18 ; TSC / SEC
mov ebx,5
int 0x40
shr eax,20
push eax
mov eax,18 ; IDLE / SEC
mov ebx,4
int 0x40
shr eax,20
xor edx,edx
imul eax,[ysi]
 
cdq
pop ebx
inc ebx
div ebx
push eax
 
mov eax,13
mov ebx,[maxx]
sub ebx,60 ;;65
shl ebx,16
mov bx,8
push ebx
mov eax,13
mov ecx,5*65536
add cx,word [ysi]
inc cx
 
push ebx
inc ecx
sub ebx,1 shl 16
add ebx,2
xor edx,edx
int 0x40
dec ecx
pop ebx
 
mov edx,0xff0000 ;[wcolor]
; sub edx,0x303030
int 0x40
pop ebx
pop eax
 
; push ebx
inc eax
mov ecx,5*65536
mov cx,ax
; pop ebx
push ecx
push ebx
sub ecx,1 shl 16
add ecx,1
sub ebx,1 shl 16
add ebx,2
mov eax,13
xor edx,edx
int 0x40
pop ebx
pop ecx
mov edx,0x44aa44 ;[wcolor]
; add edx,0x00101010
int 0x40
 
popa
 
ret
 
 
 
 
; DATA
 
stripe:
dd -0x010101
dd -0x010101
dd -0x020202
dd -0x010101
dd -0x000000
 
dd 0x000000
dd 0x010101
dd 0x020202
dd 0x010101
dd 0x010101
 
m_icon:
dd 0x0
dd 0x808080
dd 0x000000
dd 0x000000
dd 0xffffff
 
 
lsz m_text,\
ru, "Œ…ž",\
en, "MENU"
 
mi_text db 'WAVETETRBGRDGPL '
 
flag_text db 'EnFiGeRuFr'
 
type_lang db 0
;music_type db 1
sound_flag db 0
button_frames dd 0x0
 
checks dd -1
hidetext db 0x11,0x10,0x1e
iconf db 'MBAR_IX BMP'
m_bmp db 'MENUET BMP'
 
sysmeter db 'SYSMETER '
file_end db 'END '
file_sys db 'SETUP '
filename db 'MENU '
turn_text db '><'
;file1 db 'SB '
;file2 db 'TETRIS '
;file3 db 'PIC4 '
;file4 db 'TINYPAD '
;file4_par db 'COPYING.TXT',0
;file5 db 'MFASM '
file6 db 'CALENDAR '
gpl db 'GPL'
 
chlang db 'LANG',0
syslang db 'SLAN',0
 
contrast db 0
 
running_applications dd 0x100
max_applications dd 11
 
b_size_y: dd 0x0
ysi dd 0
small_draw dd 0x0
 
ptime dd 0x0
maxx dd 0x0
text db '0123456789'
bte dd 0xccddee
 
wcolor dd 0x506070
 
sec db ': '
pros db ' '
db ' '
 
screenxy dd 0x0
stcount dd 0x0
 
I_END:
area9 rb 100
system_colours rd 10
app_list rd 50
tictable:
rd 256
image:
/programs/panel/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm @panel.asm @panel
@pause
/programs/panel/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm @panel.asm @panel
@pause
/programs/panel/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/panel/trunk/setup.asm
0,0 → 1,1648
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; DEVICE SETUP ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; Authors: Ville - original version
; A. Ivushkin - autostart (w launcher)
; M. Lisovin - added many feauters (apply all, save all, set time...)
; I. Poddubny - fixed russian keymap
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte identifier
dd 0x01 ; header version
dd START ; pointer to program start
dd I_END ; size of image
dd 0x4000 ; reguired amount of memory
dd 0x4000 ; stack pointer (esp)
dd I_PARAM,0 ; parameters, reserved
include 'MACROS.INC'
;******************************************************************************
 
LLL equ (56+3)
BBB equ 25
 
;******************************************************************************
apply_all:
 
mov eax,6 ; load saved settings from SETUP.DAT
mov ebx,filename
xor ecx,ecx
or edx,-1
mov esi,keyboard
int 0x40
 
call _midibase ;1
call _sound_dma ;10
call _pci_acc ;12
call _sb16 ;4
call _wssp ;6
call _syslang ;5
call _keyboard ;2
 
call get_disk_info
cmp [cd],0
jne no_cd
call _cdbase ;3
no_cd:
cmp [hd],0
jne no_hd
call _lba_read ;11
call _hdbase ;7
call _f32p ;8
no_hd:
ret
;-------------------------------------------------------------------------------
get_disk_info:
mov [hd],1
mov [cd],1
mov [hdbase],0
mov [cdbase],0
mcall 18,11,1,table_area
 
ide_0:
mov al,[table_area+1]
shr al,6
cmp al,0
je ide_1
cmp al,01b
jnz ide_0_cd
mov [hdbase],1
mov [hd],0
jmp ide_1
 
ide_0_cd:
cmp al,10b
jnz ide_1
mov [cdbase],1
mov [cd],0
cmp [hd],0
je all_device
 
ide_1:
mov al,[table_area+1]
shl al,2
shr al,6
cmp al,0
je ide_2
cmp al,01b
jnz ide_1_cd
cmp [hd],0
je ide_11
mov [hdbase],2
mov [hd],0
ide_11:
cmp [cd],0
je all_device
jmp ide_2
 
ide_1_cd:
cmp al,10b
jnz ide_2
cmp [cd],0
je ide_11_cd
mov [cdbase],2
mov [cd],0
ide_11_cd:
cmp [hd],0
je all_device
 
ide_2:
mov al,[table_area+1]
shl al,4
shr al,6
cmp al,0
je ide_3
cmp al,01b
jnz ide_2_cd
cmp [hd],0
je ide_21
mov [hdbase],3
mov [hd],0
ide_21:
cmp [cd],0
je all_device
jmp ide_3
 
ide_2_cd:
cmp al,10b
jnz ide_3
cmp [cd],0
je ide_21_cd
mov [cdbase],3
mov [cd],0
ide_21_cd:
cmp [hd],0
je all_device
 
ide_3:
mov al,[table_area+1]
shl al,6
shr al,6
cmp al,0
je not_device
cmp al,01b
jnz ide_3_cd
cmp [hd],0
je ide_31
mov [hdbase],4
mov [hd],0
ide_31:
cmp [cd],0
jmp all_device
 
ide_3_cd:
cmp al,10b
jnz not_device
cmp [cd],0
je all_device
mov [cdbase],4
mov [cd],0
 
all_device:
not_device:
ret
 
hd db 0
cd db 0
;******************************************************************************
apply_all_and_exit:
call apply_all
jmp close
 
;******************************************************************************
set_language_and_exit:
mov eax,26
mov ebx,2
mov ecx,9
int 0x40
; cmp eax,5
; jne @f
; xor eax,eax
;@@: mov [keyboard],eax
cmp eax,1
je russian
xor eax,eax
set_lang_now:
mov [keyboard],eax
call _keyboard
jmp close
russian:
mov eax,3
jmp set_lang_now
 
set_syslanguage_and_exit:
mov eax,26
mov ebx,5
; mov ecx,9
int 0x40
cmp eax,4
jne temp ;@f
xor eax,eax
;@@: inc eax
temp: inc eax
mov [syslang],eax
call _syslang
jmp close
 
get_setup_values:
mcall 26,1
mov [midibase],eax
mcall 26,2,9
dec eax
mov [keyboard],eax
mcall 26,3
mov [cdbase],eax
mcall 26,4
mov [sb16],eax
mcall 26,5
mov [syslang],eax
mcall 26,6
cmp eax,0x530
jne s_wss_2
mov eax,1
jmp get_other
s_wss_2:
cmp eax,0x608
jne s_wss_3
mov eax,2
jmp get_other
s_wss_3:
cmp eax,0xe80
jne s_wss_4
mov eax,3
jmp get_other
s_wss_4:
mov eax,4
get_other:
mov [wss],eax
mcall 26,7
mov [hdbase],eax
mcall 26,8
mov [f32p],eax
mcall 26,10
mov [sound_dma],eax
mcall 26,11
mov [lba_read],eax
mcall 26,12
mov [pci_acc],eax
ret
 
;******************************************************************************
 
START:
cmp [I_PARAM], 'SLAN'
je set_syslanguage_and_exit
 
cmp [I_PARAM], 'LANG'
je set_language_and_exit
 
; mov eax,6 ; load saved settings from SETUP.DAT
; mov ebx,filename
; xor ecx,ecx
; or edx,-1
; mov esi,keyboard
; int 0x40
 
cmp [I_PARAM], 'BOOT'
je apply_all_and_exit
 
call loadtxt
call get_setup_values
red:
call draw_window
 
still:
 
cmp word [blinkpar],0
jne blinker
mov eax,29 ;get system date
int 0x40
cmp eax,[date]
je gettime
mov [date],eax
gettime:
mov eax,3 ;get system time
int 0x40
cmp ax,[time]
je sysevent
mov [time],ax
call drawtime
 
sysevent:
mov eax,23
mov ebx,8 ; wait here for event with timeout
int 0x40
 
cmp eax,1
jz red
cmp eax,2
jz key
cmp eax,3
jz button
 
jmp still
 
blinker:
cmp byte [count],6
jb noblink
btc dword [blinkpar],16
mov byte [count],0
call drawtime
noblink:
inc byte [count]
jmp sysevent
 
incdectime:
cmp byte [blinkpar],0
je still
mov esi,time
mov bl,0x23 ;border
cmp byte [blinkpar],1
je hours
mov bl,0x59 ;minutes
inc esi
hours:
mov al,byte [esi]
cmp ah,112
je dectime
cmp al,bl
je noinctime
inc al
daa
jmp incdectime1
noinctime:
xor al,al
incdectime1:
mov byte [esi],al
jmp still
dectime:
cmp al,0
je nodectime
dec al
das
jmp incdectime1
nodectime:
mov al,bl
jmp incdectime1
 
incdecdate:
cmp byte [blinkpar+1],0
je still
mov esi,date
mov bl,0 ;border of years
cmp byte [blinkpar+1],1
jne days
mov bl,0x12 ;months
inc esi
days:
cmp byte [blinkpar+1],2
jne nodays
mov bl,0x31
add esi,2
nodays:
mov al,byte [esi]
cmp ah,122
je decdate
cmp al,bl
je noincdate
inc al ;add al,1
daa
jmp incdecdate1
noincdate:
mov al,1
incdecdate1:
mov byte [esi],al
jmp still
decdate:
cmp al,1
je nodecdate
dec al
das
jmp incdecdate1
nodecdate:
mov al,bl
jmp incdecdate1
 
 
key:
;mov eax,2
int 0x40
cmp ah,27
jne still
mov dword [blinkpar],0
call drawtime
jmp still
 
button:
 
mov eax,17
int 0x40
 
cmp ah,112
je incdectime
cmp ah,113
je incdectime
cmp ah,122
je incdecdate
cmp ah,123
je incdecdate
cmp ah,111
jne noseltime
mov al, [blinkpar]
cmp al,2
jae seltime
inc al
jmp seltime1
seltime:
xor al,al
seltime1:
mov [blinkpar],al
call drawtime
jmp still
noseltime:
cmp ah,121
jne noseldate
mov al,byte [blinkpar+1]
cmp al,3
jae seldate
inc al
jmp seldate1
seldate:
xor al,al
seldate1:
mov [blinkpar+1],al
call drawtime
jmp still
noseldate:
cmp ah,99
jne nosaveall
mov eax,33
mov ebx,filename
mov ecx,keyboard
mov edx,48
xor esi,esi
int 0x40
call settime
mov dword [blinkpar],0
call drawtime
jmp still
nosaveall:
cmp ah,100
jne no_apply_all
call apply_all
jmp still
no_apply_all:
 
cmp ah,1 ; CLOSE APPLICATION
jne no_close
close:
or eax,-1
int 0x40
no_close:
 
cmp ah,11 ; SET MIDI BASE
jnz nosetbase1
call _midibase
nosetbase1:
cmp ah,12
jnz nomm
sub [midibase],2
call draw_infotext
nomm:
cmp ah,13
jnz nomp
add [midibase],2
call draw_infotext
nomp:
 
 
cmp ah,4 ; SET KEYBOARD
jnz nokm
mov eax,[keyboard]
test eax,eax
je downuplbl
dec eax
jmp nodownup
downuplbl:
mov eax,4
nodownup:
mov [keyboard],eax
call draw_infotext
nokm:
cmp ah,5
jnz nokp
mov eax,[keyboard]
cmp eax,4
je updownlbl
inc eax
jmp noupdown
updownlbl:
xor eax,eax
noupdown:
mov [keyboard],eax
call draw_infotext
nokp:
 
 
cmp ah,22 ; SET CD BASE
jnz nocm
mov eax,[cdbase]
sub eax,2
and eax,3
inc eax
mov [cdbase],eax
call draw_infotext
nocm:
cmp ah,23
jnz nocp
mov eax,[cdbase]
and eax,3
inc eax
mov [cdbase],eax
call draw_infotext
nocp:
cmp ah,21
jnz nocs
call _cdbase
nocs:
 
cmp ah,62 ; SET HD BASE
jnz hnocm
mov eax,[hdbase]
sub eax,2
and eax,3
inc eax
mov [hdbase],eax
call draw_infotext
hnocm:
cmp ah,63
jnz hnocp
mov eax,[hdbase]
and eax,3
inc eax
mov [hdbase],eax
call draw_infotext
hnocp:
cmp ah,61
jnz hnocs
call _hdbase
hnocs:
 
cmp ah,82 ; SET SOUND DMA
jne no_sdma_d
mov eax,[sound_dma]
dec eax
sdmal:
and eax,3
mov [sound_dma],eax
call draw_infotext
jmp still
no_sdma_d:
cmp ah,83
jne no_sdma_i
mov eax,[sound_dma]
inc eax
jmp sdmal
no_sdma_i:
cmp ah,81
jne no_set_sound_dma
call _sound_dma
jmp still
no_set_sound_dma:
 
cmp ah,92 ; SET LBA READ
jne no_lba_d
slbal:
btc [lba_read],0
call draw_infotext
jmp still
no_lba_d:
cmp ah,93
jne no_lba_i
jmp slbal
no_lba_i:
cmp ah,91
jne no_set_lba_read
call _lba_read
jmp still
no_set_lba_read:
 
 
cmp ah,102 ; SET PCI ACCESS
jne no_pci_d
pcip:
btc [pci_acc],0
call draw_infotext
jmp still
no_pci_d:
cmp ah,103
jne no_pci_i
jmp pcip
no_pci_i:
cmp ah,101
jne no_set_pci_acc
call _pci_acc
jmp still
no_set_pci_acc:
 
 
set_partition:
cmp ah,72 ; SET FAT32 PARTITION
jnz .nominus
mov eax,[f32p]
sub eax,2
; and eax,15 ; 3 - four partitions, 7 - eight p., 15 - sixteen, etc.
cmp eax,15
jb @f
mov eax,14
@@:
inc eax
mov [f32p],eax
call draw_infotext
.nominus:
cmp ah,73
jnz .noplus
mov eax,[f32p]
; and eax,15 ; 3 - four partitions, 7 - eight p., 15 - sixteen, etc.
cmp eax,15
jb @f
mov eax,0
@@:
inc eax
mov [f32p],eax
call draw_infotext
.noplus:
cmp ah,71
jnz .noapply
call _f32p
.noapply:
 
cmp ah,32 ; SET SOUND BLASTER 16 BASE
jnz nosbm
sub [sb16],2
call draw_infotext
nosbm:
cmp ah,33
jnz nosbp
add [sb16],2
call draw_infotext
nosbp:
cmp ah,31
jnz nosbs
call _sb16
nosbs:
 
cmp ah,52 ; SET WINDOWS SOUND SYSTEM BASE
jnz nowssm
mov eax,[wss]
sub eax,2
and eax,3
inc eax
mov [wss],eax
call draw_infotext
nowssm:
cmp ah,53
jnz nowssp
mov eax,[wss]
and eax,3
inc eax
mov [wss],eax
call draw_infotext
nowssp:
cmp ah,51
jnz nowsss
call _wssp
nowsss:
 
cmp ah,42 ; SET SYSTEM LANGUAGE BASE
jnz nosysm
mov eax,[syslang]
dec eax
jz still
mov [syslang],eax
call draw_infotext
nosysm:
cmp ah,43
jnz nosysp
mov eax,[syslang]
cmp eax,4
je nosysp
inc eax
mov [syslang],eax
call draw_infotext
nosysp:
cmp ah,41
jnz nosyss
call _syslang
call cleantxt
call loadtxt
call draw_window
call drawtime
nosyss:
 
cmp ah,3 ; SET KEYMAP
jne still
call _keyboard
jmp still
 
_keyboard:
cmp [keyboard],0
jnz nosetkeyle
mov eax,21 ; english
mov ebx,2
mov ecx,1
mov edx,en_keymap
int 0x40
mov eax,21
inc ecx
mov edx,en_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,1
int 0x40
call alt_gen
nosetkeyle:
cmp [keyboard],1
jnz nosetkeylfi
mov eax,21 ; finnish
mov ebx,2
mov ecx,1
mov edx,fi_keymap
int 0x40
mov eax,21
inc ecx
mov edx,fi_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,2
int 0x40
call alt_gen
nosetkeylfi:
cmp [keyboard],2
jnz nosetkeylge
mov eax,21 ; german
mov ebx,2
mov ecx,1
mov edx,ge_keymap
int 0x40
mov eax,21
inc ecx
mov edx,ge_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,3
int 0x40
call alt_gen
nosetkeylge:
cmp [keyboard],3
jnz nosetkeylru
mov eax,21 ; russian
mov ebx,2
mov ecx,1
mov edx,ru_keymap
int 0x40
mov eax,21
inc ecx
mov edx,ru_keymap_shift
int 0x40
call alt_gen
mov eax,21
mov ecx,9
mov edx,4
int 0x40
nosetkeylru:
cmp [keyboard],4 ;french
jnz nosetkeylfr
mov eax,21
mov ebx,2
mov ecx,1
mov edx,fr_keymap
int 0x40
mov eax,21
inc ecx
mov edx,fr_keymap_shift
int 0x40
mov eax,21
inc ecx
mov edx,fr_keymap_alt_gr
int 0x40
mov eax,21
mov ecx,9
mov edx,5
int 0x40
nosetkeylfr:
ret
 
alt_gen:
mov eax,21
mov ecx,3
mov edx,alt_general
int 0x40
ret
 
 
 
draw_buttons:
 
pusha
 
shl ecx,16
add ecx,12
mov ebx,(350-50)*65536+46+BBB
 
mov eax,8
int 0x40
 
mov ebx,(350-79)*65536+9
inc edx
int 0x40
 
mov ebx,(350-67)*65536+9
inc edx
int 0x40
 
popa
ret
 
 
 
; ********************************************
; ******* WINDOW DEFINITIONS AND DRAW *******
; ********************************************
 
 
draw_window:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
xor eax,eax ; DRAW WINDOW
mov ebx,40*65536+355+BBB
mov ecx,40*65536+300
mov edx,0x82111199
mov esi,0x805588dd
mov edi,0x005588dd
int 0x40
 
mov eax,4
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,labelt
cmp [syslang],4
je ruslabel
add edx,20
ruslabel:
mov esi,26
int 0x40
 
mov eax,8 ; CLOSE BUTTON
mov ebx,(355+BBB-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x005588dd
int 0x40
; APPLY ALL
mov ebx,(350-79)*65536+100
mov ecx,251*65536+12
mov edx,100
int 0x40
add ecx,16*65536 ; SAVE ALL
dec edx
int 0x40
 
mov esi,0x5580c0
 
mov edx,11
mov ecx,43
call draw_buttons
 
mov edx,41
mov ecx,43+8*8
call draw_buttons
 
mov edx,21
mov ecx,43+4*8
call draw_buttons
 
mov edx,31
mov ecx,43+2*8
call draw_buttons
 
mov edx,3
mov ecx,43+10*8
call draw_buttons
 
mov edx,51
mov ecx,43+12*8
call draw_buttons
 
mov edx,61
mov ecx,43+6*8
call draw_buttons
 
mov edx,91
mov ecx,43+18*8
call draw_buttons
 
mov edx,71
mov ecx,43+14*8
call draw_buttons
 
mov edx,81
mov ecx,43+16*8
call draw_buttons
 
mov edx,101
mov ecx,43+20*8
call draw_buttons
 
mov edx,111
mov ecx,43+22*8 ; 22
call draw_buttons
 
mov edx,121
mov ecx,43+24*8 ; 24
call draw_buttons
 
call draw_infotext
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
 
draw_infotext:
 
pusha
 
mov eax,[keyboard] ; KEYBOARD
test eax,eax
jnz noen
mov [text00+LLL*10+28],dword 'ENGL'
mov [text00+LLL*10+32],dword 'ISH '
noen:
cmp eax,1
jnz nofi
mov [text00+LLL*10+28],dword 'FINN'
mov [text00+LLL*10+32],dword 'ISH '
nofi:
cmp eax,2
jnz noge
mov [text00+LLL*10+28],dword 'GERM'
mov [text00+LLL*10+32],dword 'AN '
noge:
cmp eax,3
jnz nogr
mov [text00+LLL*10+28],dword 'RUSS'
mov [text00+LLL*10+32],dword 'IAN '
nogr:
cmp eax,4
jnz nofr
mov [text00+LLL*10+28],dword 'FREN'
mov [text00+LLL*10+32],dword 'CH '
nofr:
 
 
mov eax,[syslang] ; SYSTEM LANGUAGE
dec eax
test eax,eax
jnz noen5
mov [text00+LLL*8+28],dword 'ENGL'
mov [text00+LLL*8+32],dword 'ISH '
noen5:
cmp eax,1
jnz nofi5
mov [text00+LLL*8+28],dword 'FINN'
mov [text00+LLL*8+32],dword 'ISH '
nofi5:
cmp eax,2
jnz noge5
mov [text00+LLL*8+28],dword 'GERM'
mov [text00+LLL*8+32],dword 'AN '
noge5:
cmp eax,3
jnz nogr5
mov [text00+LLL*8+28],dword 'RUSS'
mov [text00+LLL*8+32],dword 'IAN '
nogr5:
cmp eax,4
jne nofr5
mov [text00+LLL*8+28],dword 'FREN'
mov [text00+LLL*8+32],dword 'CH '
nofr5:
 
 
mov eax,[midibase]
mov esi,text00+LLL*0+32
call hexconvert ; MIDI BASE
 
 
mov eax,[sb16] ; SB16 BASE
mov esi,text00+LLL*2+32
call hexconvert
 
 
mov eax,[wss] ; WSS BASE
cmp eax,1
jnz nowss1
mov [wssp],dword 0x530
nowss1:
cmp eax,2
jnz nowss2
mov [wssp],dword 0x608
nowss2:
cmp eax,3
jnz nowss3
mov [wssp],dword 0xe80
nowss3:
cmp eax,4
jnz nowss4
mov [wssp],dword 0xf40
nowss4:
 
mov eax,[wssp]
mov esi,text00+LLL*12+32
call hexconvert
 
mov eax,[cdbase] ; CD BASE
cmp eax,1
jnz noe1
mov [text00+LLL*4+28],dword 'PRI.'
mov [text00+LLL*4+32],dword 'MAST'
mov [text00+LLL*4+36],dword 'ER '
noe1:
cmp eax,2
jnz nof1
mov [text00+LLL*4+28],dword 'PRI.'
mov [text00+LLL*4+32],dword 'SLAV'
mov [text00+LLL*4+36],dword 'E '
nof1:
cmp eax,3
jnz nog1
mov [text00+LLL*4+28],dword 'SEC.'
mov [text00+LLL*4+32],dword 'MAST'
mov [text00+LLL*4+36],dword 'ER '
nog1:
cmp eax,4
jnz nog2
mov [text00+LLL*4+28],dword 'SEC.'
mov [text00+LLL*4+32],dword 'SLAV'
mov [text00+LLL*4+36],dword 'E '
nog2:
 
 
mov eax,[hdbase] ; HD BASE
cmp eax,1
jnz hnoe1
mov [text00+LLL*6+28],dword 'PRI.'
mov [text00+LLL*6+32],dword 'MAST'
mov [text00+LLL*6+36],dword 'ER '
hnoe1:
cmp eax,2
jnz hnof1
mov [text00+LLL*6+28],dword 'PRI.'
mov [text00+LLL*6+32],dword 'SLAV'
mov [text00+LLL*6+36],dword 'E '
hnof1:
cmp eax,3
jnz hnog1
mov [text00+LLL*6+28],dword 'SEC.'
mov [text00+LLL*6+32],dword 'MAST'
mov [text00+LLL*6+36],dword 'ER '
hnog1:
cmp eax,4
jnz hnog2
mov [text00+LLL*6+28],dword 'SEC.'
mov [text00+LLL*6+32],dword 'SLAV'
mov [text00+LLL*6+36],dword 'E '
hnog2:
 
 
mov eax,[f32p] ; FAT32 PARTITION
add al,48
mov [text00+LLL*14+28],al
 
mov eax,[sound_dma] ; SOUND DMA
add eax,48
mov [text00+LLL*16+28],al
 
mov eax,[lba_read]
call onoff ; LBA READ
mov [text00+LLL*18+28],ebx
 
mov eax,[pci_acc]
call onoff ; PCI ACCESS
mov [text00+LLL*20+28],ebx
 
mov eax,13
mov ebx,175*65536+85
mov ecx,40*65536+205
mov edx,0x80111199-19
int 0x40
 
mov edx,text00
mov ebx,10*65536+45
mov eax,4
mov ecx,0xffffff
mov esi,LLL
newline:
int 0x40
add ebx,8
add edx,LLL
cmp [edx],byte 'x'
jnz newline
 
popa
ret
 
drawtime:
mov ax,[time] ;hours 22
mov cl,1
call unpacktime
mov [text00+LLL*22+28],word bx
mov al,ah ;minutes
inc cl
call unpacktime
mov [text00+LLL*22+31],word bx
mov eax,[date]
mov ch,3
call unpackdate
mov [text00+LLL*24+34],word bx ;year 24
mov al,ah
mov ch,1
call unpackdate
mov [text00+LLL*24+28],word bx ;month
bswap eax
mov al,ah
inc ch
call unpackdate
mov [text00+LLL*24+31],word bx ;day
 
mov eax,13
mov ebx,175*65536+85
mov ecx,40*65536+205
mov edx,0x80111199-19
int 0x40
 
mov edx,text00
mov ebx,10*65536+45
mov eax,4
mov ecx,0xffffff
mov esi,LLL
newline1:
int 0x40
add ebx,8
add edx,LLL
cmp [edx],byte 'x'
jnz newline1
ret
 
unpacktime:
cmp byte [blinkpar],cl ;translate packed number to ascii
jne unpack1
chkblink:
bt dword [blinkpar],16
jnc unpack1
xor bx,bx
ret
unpackdate:
cmp byte [blinkpar+1],ch
je chkblink
unpack1:
xor bx,bx
mov bh,al
mov bl,al
and bh,0x0f
shr bl,4
add bx,0x3030
ret
 
hexconvert: ;converting dec to hex in ascii
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
mov [esi],cl
shr eax,4
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
dec esi
mov [esi],cl
shr eax,4
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
dec esi
mov [esi],cl
ret
 
onoff:
cmp [syslang],4
jne norus1
mov ebx,'„€ '
cmp eax,1
je exitsub
mov ebx,'…’ '
ret
norus1:
mov ebx,'ON '
cmp eax,1
je exitsub
mov ebx,'OFF '
exitsub:
ret
 
_midibase:
mov eax,21
mov ebx,1
mov ecx,[midibase]
int 0x40
ret
 
_cdbase:
mov eax,21
mov ebx,3
mov ecx,[cdbase]
int 0x40
ret
 
_hdbase:
mov eax,21
mov ebx,7
mov ecx,[hdbase]
int 0x40
ret
 
_sound_dma:
mov eax,21
mov ebx,10
mov ecx,[sound_dma]
int 0x40
ret
 
_lba_read:
mov eax,21
mov ebx,11
mov ecx,[lba_read]
int 0x40
ret
 
_pci_acc:
mov eax,21
mov ebx,12
mov ecx,[pci_acc]
int 0x40
ret
 
_f32p:
mov eax,21
mov ebx,8
mov ecx,[f32p]
int 0x40
ret
 
_sb16:
mov eax,21
mov ebx,4
mov ecx,[sb16]
int 0x40
ret
 
_wssp:
mov eax,21
mov ebx,6
mov ecx,[wssp]
int 0x40
ret
 
_syslang:
mov eax,21
mov ebx,5
mov ecx,[syslang]
int 0x40
ret
 
loadtxt:
cld
mov edi,text00
mov ecx,428
cmp [syslang],4
jne norus
mov esi,textrus
jmp sload
norus:
mov esi,texteng
sload:
rep movsd
ret
 
cleantxt:
xor eax,eax
mov ecx,428
cld
mov edi,text00
rep stosd
mov [text00+1711],byte 'x'
ret
 
settime:
mov dx,0x70
call startstopclk
dec dx
mov al,2 ;set minutes
out dx,al
inc dx
mov al,byte [time+1]
out dx,al
dec dx
mov al,4 ;set hours
out dx,al
inc dx
mov al,byte [time]
out dx,al
dec dx
mov al,7 ;set day
out dx,al
inc dx
mov al,byte [date+2]
out dx,al
dec dx
mov al,8 ;set month
out dx,al
inc dx
mov al,byte [date+1]
out dx,al
dec dx
mov al,9 ;set year
out dx,al
inc dx
mov al,byte [date]
out dx,al
dec dx
call startstopclk
ret
 
startstopclk:
mov al,0x0b
out dx,al
inc dx
in al,dx
btc ax,7
out dx,al
ret
 
; DATA AREA
count: db 0x0
blinkpar: dd 0x0
time: dw 0x0
date: dd 0x0
 
filename: db 'SETUP DAT',0
 
textrus:
 
db ' §  MIDI ROLAND MPU-401 : 0x320 - + à¨¬¥­¨âì'
db ' '
db ' §  SoundBlaster 16 : 0x240 - + à¨¬¥­¨âì'
db ' '
db ' §  CD-ROM  : PRI.SLAVE - + à¨¬¥­¨âì'
db ' '
db ' §  †„-1 : PRI.MASTER - + à¨¬¥­¨âì'
db ' '
db 'Ÿ§ëª á¨á⥬ë : ENGLISH - + à¨¬¥­¨âì'
db ' '
db ' áª« ¤ª  ª« ¢¨ âãàë : ENGLISH - + à¨¬¥­¨âì'
db ' '
db ' §  WSS : 0x200 - + à¨¬¥­¨âì'
db ' '
db ' §¤¥« FAT32 ­  †„-1 : 1 - + à¨¬¥­¨âì'
db ' '
db '‡¢ãª®¢®© ª ­ « DMA : 1 - + à¨¬¥­¨âì'
db ' '
db '‚ª«îç¨âì LBA : OFF - + à¨¬¥­¨âì'
db ' '
db '„®áâ㯠ª 設¥ PCI : OFF - + à¨¬¥­¨âì'
db ' '
db '‘¨á⥬­®¥ ¢à¥¬ï : 0:00 - + ‚ë¡®à '
db ' '
db '‘¨á⥬­ ï ¤ â  (¬,¤,£) : 00/00/00 - + ‚ë¡®à '
db ' '
db '‚ˆŒ€ˆ…: à¨¬¥­¨âì ¢á¥ '
db 'ˆ‘Ž‹œ‡“‰’… „Ž‘’“ Š FAT-32 Ž‘’ŽŽ†Ž! '
db '… ‡€“„œ’… ‘Ž•€ˆ’œ €‘’Ž‰Šˆ ‘®åà ­¨âì ¢á¥ '
db 'x'
 
texteng:
 
db 'MIDI: ROLAND MPU-401 BASE : 0x320 - + APPLY '
db ' '
db 'SOUND: SB16 BASE : 0x240 - + APPLY '
db ' '
db 'CD-ROM BASE : PRI.SLAVE - + APPLY '
db ' '
db 'HARDDISK-1 BASE : PRI.MASTER - + APPLY '
db ' '
db 'SYSTEM LANGUAGE : ENGLISH - + APPLY '
db ' '
db 'KEYBOARD LAYOUT : ENGLISH - + APPLY '
db ' '
db 'WINDOWS SOUND SYSTEM BASE : 0x200 - + APPLY '
db ' '
db 'FAT32-1 PARTITION IN HD-1 : 1 - + APPLY '
db ' '
db 'SOUND DMA CHANNEL : 1 - + APPLY '
db ' '
db 'LBA READ ENABLED : OFF - + APPLY '
db ' '
db 'PCI ACCESS FOR APPL. : OFF - + APPLY '
db ' '
db 'SYSTEM TIME : 0:00 - + SELECT '
db ' '
db 'SYSTEM DATE (M,D,Y) : 00/00/00 - + SELECT '
db ' '
db 'NOTE: APPLY ALL '
db 'TEST FAT32 FUNCTIONS WITH EXTREME CARE '
db 'SAVE YOUR SETTINGS BEFORE QUIT MENUET SAVE ALL '
db 'x'
 
labelt:
db '€‘’Ž‰Š€ “‘’Ž‰‘’‚ MENUET DEVICE SETUP '
 
hex db '0123456789ABCDEF'
 
alt_general:
 
; db ' ',27
; db ' @ $ {[]}\ ',8,9
; db ' ',13
; db ' ',0,' ',0,'4',0,' '
; db ' ',180,178,184,'6',176,'7'
; db 179,'8',181,177,183,185,182
; db 'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
en_keymap:
 
db '6',27
db '1234567890-=',8,9
db 'qwertyuiop[]',13
db '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
en_keymap_shift:
 
db '6',27
db '!@#$%^&*()_+',8,9
db 'QWERTYUIOP{}',13
db '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fr_keymap:
 
db '6',27
db '&Ž"',39,'(-_“)=',8,9
db 'azertyuiop^$',13
db '~qsdfghjklm’',0,0,'*wxcvbn,;:!',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
fr_keymap_shift:
 
 
db '6',27
db '1234567890+',8,9
db 'AZERTYUIOP•”',13
db '~QSDFGHJKLM%',0,'–WXCVBN?./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fr_keymap_alt_gr:
 
 
db '6',27
db 28,'~#{[|˜\^@]}',8,9
db 'azertyuiop^$',13
db '~qsdfghjklm’',0,0,'*wxcvbn,;:!',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
 
fi_keymap:
 
db '6',27
db '1234567890+[',8,9
db 'qwertyuiop',192,'~',13
db '~asdfghjkl',194,193,'1',0,39,'zxcvbnm,.-',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fi_keymap_shift:
 
db '6',27
db '!"#%&/()=?]',8,9
db 'QWERTYUIOP',200,'~',13
db '~ASDFGHJKL',202,201,'1',0,'*ZXCVBNM;:_',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
ge_keymap:
 
db '6',27
db '1234567890?[',8,9
db 'qwertzuiop',203,'~',13
db '~asdfghjkl',194,193,'1',0,39,'yxcvbnm,.-',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
ge_keymap_shift:
 
db '6',27
db '!"#$%&/()=',197,']',8,9
db 'QWERTZUIOP',195,'~',13
db '~ASDFGHJKL',202,201,'1',0,'*YXCVBNM;:_',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
ru_keymap:
 
db '6',27
db '1234567890-=',8,9
db '©æ㪥­£èé§åê',13
db 0,"ä뢠¯à®«¤¦í"
db 0xf1, '-/'
db "ïçᬨâì¡î",'.-','45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
ru_keymap_shift:
 
db '6',27
db '!"N;%:?*()_+',8,0
db "‰–“Š…ƒ˜™‡•š",13
db 0,"”›‚€Ž‹„†"
db 0xf0, '-\'
db "Ÿ—‘Œˆ’œž",',-','45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
I_PARAM dd 0
 
keyboard dd 0x0
midibase dd 0x320
cdbase dd 0x2
sb16 dd 0x220
syslang dd 0x1
wss dd 0x1
wssp dd 0x0
hdbase dd 0x1
f32p dd 0x1
sound_dma dd 0x1
lba_read dd 0x1
pci_acc dd 0x1
 
text00:
 
I_END:
table_area:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/param/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm param.asm param
@pause
/programs/param/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm param.asm param
@pause
/programs/param/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
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/param/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/param/trunk/param.asm
0,0 → 1,56
use32
 
org 0x0
 
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x100000
dd 0x7fff0
dd I_PARAM ; 㪠§ â¥«ì ­  ¯ à ¬¥âàë
 
include "lang.inc"
include "cmdipc.inc" ; ®¤ª«îç¨âì ä ©« CMDIPC.INC
 
START:
call initipc ; ¨­¨æ¨ «¨§¨à®¢ âì ¤«ï à ¡®âë á CMD
 
mov eax,47 ; ¢ë¢¥á⨠ᮮ¡é¥­¨¥
mov ebx,mess
call print
 
call eol ; ¯à®¯ãáâ¨âì áâபã
call eol
 
cmp [I_PARAM],byte 0 ; ¯à®¢¥à¨âì, ¥áâì «¨ ¯ à ¬¥âàë
jz noparam
 
mov eax,43
mov ebx,mess1
call print
 
call eol
 
mov eax,30 ; ¢ë¢¥á⨠¯ à ¬¥âàë
mov ebx,I_PARAM
call print
 
jmp end1 ; ¯¥à¥å®¤ ¢ ª®­¥æ ¯à®£à ¬¬ë
 
noparam:
mov eax,40 ; ¢ë¢¥á⨠ᮮ¡é¥­¨¥ ® ⮬, çâ® ­¥â ¯ à ¬¥â஢
mov ebx,mess2
call print
 
end1:
jmp endipc ; § ¢¥àè¨âì ¯à®£à ¬¬ã
 
mess db 'PARAM.ASM - Test params in IPC programs for CMD'
 
mess1 db 'This program was started with this params: '
mess2 db 'This program was started without params!'
 
I_PARAM db 0
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pcidev/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm pcidev.asm pcidev
@pause
/programs/pcidev/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm pcidev.asm pcidev
@pause
/programs/pcidev/trunk/pcidev.asm
0,0 → 1,1041
;***************************************************************
; project name: PCI Device Enumeration
; target platform: MenuetOS, x86 (IA-32), x86-64 achitectures
; compiler: flat assmebler 1.60
; version: 1.25
; last update: 2th October 2005
; maintained by: Sergey Kuzmin aka Wildwest
; e-mail: kuzmin_serg@list.ru
; project site: http://coolthemes.narod.ru/pcidev.html
;***************************************************************
;Summary: This program will attempt to scan the PCI Bus
; and display basic information about each device
; connected to the PCI Bus.
;***************************************************************
;HISTORY:
;keep dates in european format (dd/mm/yyyy), please
; '!' means big changes
; to-do:
;PCI version should be normalized (0210->02.10)
;----------------------------------------------------------------
;1.25: PCIDEV 02/10/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Features: !Description is based on Class and SubClass now (PCI 3.0)
; deleted label Descriptions (names of Classes)
; names of Classes and SubClasses are in the end of Vendors.inc
;----------------------------------------------------------------
;1.20: PCIDEV 16/08/2005
;Author: Victor Alberto Gil Hanla a.k.a. vhanla <vhanla@gmail.com>
;Features: !added many vendor lists (865)
; previous version's list deleted
; previous Company Name searching and printing changed
;NOTE:
; It was only tested in my old PII Computer,
; there might be some bugs... PLZ test it and send comments
;----------------------------------------------------------------
;1.15: PCIDEV 03/06/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Features: added quantity of devices,
; ! detection of Company Name based on Vendor ID,
; database of VenID (35 ID's),
; macros.inc for smaller size,
; interface+(skinned window),
; VenID before DevID in 'table'(was DevID before VenID)
;----------------------------------------------------------------
;1.0: PCIDEV 30/01/2005
;Author: Jason Delozier
;Features: able to detect PCI version, quantity of PCI buses,
; Vendor&Device ID for appropriate Device on Bus;
; detect Revision, Class and Subclass of Device,
; and make Description based on Class
;-------------------------------------------------------------
use32
 
org 0x0
 
db 'MENUET01'; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0xE000 ; memory for app E000
dd 0xE000 ; esp E000
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'macros.inc'
include 'VENDORS.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 ; 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,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+750 ; [x start] *65536 + [x size]
mov ecx,20*65536+550 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; 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
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 [total],0
 
mov ebx, 20*65536+25 ;Draw work format
mov ecx, 0x224466
mov edx, PCIWin
mov esi, 106 ; lenght of line
newline:
mov eax, 4
int 0x40
add ebx, 10
add edx, 106 ; lenght of line
cmp [edx], byte 'x'
jne newline
 
 
call Get_PCI_Info
 
mov cx, [PCI_Version]
mov eax, 47
mov ebx, 0x00040100
mov esi, 0x00000000
mov edx, 110*65536+45
int 0x40
 
mov cl, [PCI_LastBus]
mov eax, 47
mov ebx, 0x00020100
mov esi, 0x00000000
mov edx, 110*65536+55
int 0x40
 
call scan_Pci
 
xor ecx, ecx
mov cl, [total]
mov eax, 47
mov ebx, 0x00020000
mov esi, 0x00000000
mov edx, 150*65536+65
int 0x40
 
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
; ***********************************************
; ******* END WINDOW DEFINITIONS & DRAW *******
; ***********************************************
 
Get_PCI_Info:
mov eax, 62
mov ebx, 0
int 0x40
mov [PCI_Version], ax
;mov [PCI_Version_h], ah
;mov [PCI_Version_l], al
 
mov eax, 62
mov ebx, 1
int 0x40
mov [PCI_LastBus], al
ret
 
 
 
scan_Pci:
cmp [PCI_LastBus],0xff
jne Pci_Exists
ret
Pci_Exists:
mov [V_Bus], 0 ;reset varibles
mov [V_Dev], 0 ;
mov edx, 20*65536+110 ;start write position
 
Start_Enum:
mov bl, 6 ;get Device ID / Vendor ID
mov bh, [V_Bus]
mov ch, [V_Dev]
mov cl, 0
mov eax, 62
int 0x40
 
cmp ax, 0 ;check next slot if nothing exists
je nextDev
cmp ax, 0xffff
je nextDev
 
mov [PCI_Vendor], ax
shr eax, 16
mov [PCI_Device], ax
 
mov eax, 62 ;PCI Sys Function
mov bl, 4 ;Read config byte
mov bh, [V_Bus] ;Bus #
mov ch, [V_Dev] ;Device # on bus
mov cl, 0x08 ;Register to read (Get Revision)
int 0x40 ;Read it
mov [PCI_Rev], al ;Save it
 
mov eax, 62 ;PCI Sys Function
mov cl, 0x0b ;Register to read (Get class)
int 0x40 ;Read it
mov [PCI_Class], al ;Save it
 
mov eax, 62 ;PCI Sys Function
mov cl, 0x0a ;Register to read (Get Subclass)
int 0x40 ;Read it
mov [PCI_SubClass], al ;Save it
 
call Print_New_Device
 
nextDev:
inc [V_Dev]
jno Start_Enum ;jump if no overflow (<256)
 
mov [V_Dev], 0
inc [V_Bus]
mov al, [PCI_LastBus]
 
cmp byte [V_Bus], al
jbe Start_Enum
ret
 
Print_New_Device:
inc [total]
 
mov eax, 47 ;Write number to screen
mov ebx,0x00040100 ;4 byte number, print in hexidecimal
mov esi, 0x00000000 ;Color of text
xor ecx,ecx
mov cx,[PCI_Vendor] ;Pointer to number to be written
int 0x40 ;Write it
 
push dx ;Calculate position
mov dx, 62 ;
shl edx, 16 ;
pop dx ;
mov cx, [PCI_Device] ;Write Vendor ID
int 0x40 ;
 
mov ebx, 0x00020100 ;2 byte number, in hexidecimal format
push dx ;move write cursor
mov dx, 110 ;
shl edx, 16 ;
pop dx ;
mov cl, [V_Bus] ;write bus number
int 0x40 ;
 
push dx ;move write cursor
mov dx, 146 ;
shl edx, 16 ;
pop dx ;
mov cl, [V_Dev] ;Write device number
int 0x40 ;
 
push dx ;move write cursor
mov dx, 179 ;
shl edx, 16 ;
pop dx ;
mov cl, [PCI_Rev] ;Draw Revision to screen
int 0x40 ;
 
push dx ;move write cursor
mov dx, 215 ;
shl edx, 16 ;
pop dx ;
mov cl, [PCI_Class] ;Draw Class to screen
int 0x40 ;
 
push dx ;move write curson
mov dx, 266 ;
shl edx, 16 ;
pop dx ;
mov cl, [PCI_SubClass] ;Draw Sub Class to screen
int 0x40 ;
 
 
;Write Names
push dx ;remember our current write line
mov esi, 17 ;length of text
mov bx, 310 ;X-position of text on screen
shl ebx, 16 ;
mov bx, dx ;Current Y position
mov ecx, 0 ;color of text
 
mov [cur], dx
 
mov [r],0
;**********************************************************
; modified part by vhanla (I know it is not a fastest way to search)
; it needs optimization... HELP this project!
;-------------------------------------------------------------------------------
cmp [PCI_Vendor],4807 ; Check if Vendor's value is less than this number
jae next1 ; if it is less, let's continue, or jump to next1
mov [listcount],255 ; number of available lists into this range
mov [r],1 ; counter
mov [valor],50 ; List's number of characters = 50
rep1:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[_FIRSTPART+bx]
mov [address],_FIRSTPART
add [address],ebx
sub [address],50
pop ebx
cmp [PCI_Vendor],ax
jz ex
add [valor],52 ; Number of characters plus value (WORD) 50+2 bytes
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next1
inc [r]
jmp rep1
;-------------------------------------------------------------------------------
next1:
cmp [PCI_Vendor],5320
jae next2
mov [listcount],255 ; number of available lists into this range
mov [r],1
mov [valor],50
rep2:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[_SECONDPART+bx]
mov [address],_SECONDPART
add [address],ebx
sub [address],50
pop ebx
cmp [PCI_Vendor],ax
jz ex
add [valor],52
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next2
inc [r]
jmp rep2
;-------------------------------------------------------------------------------
next2:
cmp [PCI_Vendor],5580
jae next3
mov [listcount],255 ; number of available lists into this range
mov [r],1
mov [valor],50
rep3:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[_THIRDPART+bx]
mov [address],_THIRDPART
add [address],ebx
sub [address],50
pop ebx
cmp [PCI_Vendor],ax
jz ex
add [valor],52
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next3
inc [r]
jmp rep3
;-------------------------------------------------------------------------------
next3:
cmp [PCI_Vendor],65535 ;the last in a WORD
jae next4
mov [listcount],100 ; number of available lists into this range
mov [r],1
mov [valor],50
rep4:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[_FOURTHPART+bx]
mov [address],_FOURTHPART
add [address],ebx
sub [address],50
pop ebx
cmp [PCI_Vendor],ax
jz ex
add [valor],52
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next4
inc [r]
jmp rep4
;-------------------------------------------------------------------------------
next4:
 
;-------------------------------------------------------------------------------
; tHIS PART FOR OTHER ... LISTS
mov [listcount],7 ; number of available lists into this range
mov [r],1
mov [valor],50
repO:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[PREVIOUSVERSIONLIST+bx]
mov [address],PREVIOUSVERSIONLIST
add [address],ebx
sub [address],50
pop ebx
cmp [PCI_Vendor],ax
jz ex
add [valor],52
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next5
inc [r]
jmp repO
;-------------------------------------------------------------------------------
next5:
mov [address],_UNKNOWN
;-------------------------------------------------------------------------------
ex:
; lets print the vendor Name
 
mov eax,4
mov edx,[address]
mov esi,50
int 0x40
;-------------------------------------------------------------------------------
; END OF SEARCHING AND PRINTING
;------------------------------------------------------------------
 
; mov esi, 26 ;length of text
; mov bx, 560 ;X-position of text on screen
; shl ebx, 16 ;
; mov bx, [cur] ;Current Y position
; mov ecx, 0 ;color of text
 
 
; xor eax, eax ;calculate pointer to string
; mov al, [PCI_Class] ;Determine Description based on class
; mov dl, 26 ;Each description is 26 characters long
; mul dl ;get offset to correct description
; mov edx, Descriptions ;starting point of description text
; add edx, eax ;calculated corresponding description
; mov eax, 4 ;draw text sys function
; int 0x40
cmp [PCI_Class], 00h
je sub0
cmp [PCI_Class], 01h
je sub1
cmp [PCI_Class], 02h
je sub2
cmp [PCI_Class], 03h
je sub3
cmp [PCI_Class], 04h
je sub4
cmp [PCI_Class], 05h
je sub5
cmp [PCI_Class], 06h
je sub6
cmp [PCI_Class], 07h
je sub7
cmp [PCI_Class], 08h
je sub8
cmp [PCI_Class], 09h
je sub9
cmp [PCI_Class], 0Ah
je sub10
cmp [PCI_Class], 0Bh
je sub11
cmp [PCI_Class], 0Ch
je sub12
cmp [PCI_Class], 0Dh
je sub13
cmp [PCI_Class], 0Eh
je sub14
cmp [PCI_Class], 0Fh
je sub15
cmp [PCI_Class], 10h
je sub16
cmp [PCI_Class], 11h
je sub17
jmp endd
sub0:
mov [listcount],2 ; number of available lists into this range
mov [r],1
mov [valor],32
repu0:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class0+bx]
mov [address],Class0
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu0
jmp endd
 
sub1:
mov [listcount],8 ; number of available lists into this range
mov [r],1
mov [valor],32
repu1:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class1+bx]
mov [address],Class1
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu1
jmp endd
 
 
sub2:
mov [listcount],8 ; number of available lists into this range
mov [r],1
mov [valor],32
repu2:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class2+bx]
mov [address],Class2
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu2
jmp endd
 
sub3:
mov [listcount],4 ; number of available lists into this range
mov [r],1
mov [valor],32
repu3:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class3+bx]
mov [address],Class3
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu3
jmp endd
 
 
sub4:
mov [listcount],4 ; number of available lists into this range
mov [r],1
mov [valor],32
repu4:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class4+bx]
mov [address],Class4
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu4
jmp endd
 
sub5:
mov [listcount],3 ; number of available lists into this range
mov [r],1
mov [valor],32
repu5:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class5+bx]
mov [address],Class5
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu5
jmp endd
 
sub6:
mov [listcount],12 ; number of available lists into this range
mov [r],1
mov [valor],32
repu6:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class6+bx]
mov [address],Class6
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu6
jmp endd
 
sub7:
mov [listcount],7 ; number of available lists into this range
mov [r],1
mov [valor],32
repu7:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class7+bx]
mov [address],Class7
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu7
jmp endd
 
sub8:
mov [listcount],8 ; number of available lists into this range
mov [r],1
mov [valor],32
repu8:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class8+bx]
mov [address],Class8
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu8
jmp endd
 
sub9:
mov [listcount],6 ; number of available lists into this range
mov [r],1
mov [valor],32
repu9:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class9+bx]
mov [address],Class9
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu9
jmp endd
 
sub10:
mov [listcount],2 ; number of available lists into this range
mov [r],1
mov [valor],32
repu10:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[ClassA+bx]
mov [address],ClassA
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu10
jmp endd
 
sub11:
mov [listcount],7 ; number of available lists into this range
mov [r],1
mov [valor],32
repu11:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[ClassB+bx]
mov [address],ClassB
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu11
jmp endd
 
sub12:
mov [listcount],10 ; number of available lists into this range
mov [r],1
mov [valor],32
repu12:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[ClassC+bx]
mov [address],ClassC
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu12
jmp endd
 
sub13:
mov [listcount],8 ; number of available lists into this range
mov [r],1
mov [valor],32
repu13:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[ClassD+bx]
mov [address],ClassD
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu13
jmp endd
 
sub14:
mov [listcount],1 ; number of available lists into this range
mov [r],1
mov [valor],32
repu14:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[ClassE+bx]
mov [address],ClassE
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu14
jmp endd
 
sub15:
mov [listcount],4 ; number of available lists into this range
mov [r],1
mov [valor],32
repu15:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[ClassF+bx]
mov [address],ClassF
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu15
jmp endd
 
sub16:
mov [listcount],3 ; number of available lists into this range
mov [r],1
mov [valor],32
repu16:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class10+bx]
mov [address],Class10
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu16
jmp endd
 
sub17:
mov [listcount],5 ; number of available lists into this range
mov [r],1
mov [valor],32
repu17:
push ebx
xor ebx,ebx
mov bx,[valor]
mov ax,word[Class11+bx]
mov [address],Class11
add [address],ebx
sub [address],32
pop ebx
cmp word [PCI_SubClass],ax
jz endd
add [valor],34
push eax
mov ah,[r]
cmp [listcount],ah
pop eax
jz next50
inc [r]
jmp repu17
jmp endd
 
next50:
mov [address],_UNKNOWND
endd:
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
mov bx, 560 ;X-position of text on screen
shl ebx, 16 ;
mov bx, [cur] ;Current Y position
mov ecx, 0 ;color of text
 
mov eax,4
mov edx,[address]
mov esi,32
int 0x40
mov dx, 20 ;Starting Y coordinate
shl edx, 16 ;
pop dx ;
add edx, 10 ;Next line down
 
ret
 
 
 
; DATA AREA
 
labelt:
db 'PCI Device Enumeration v 1.25 by J. Delozier, S. Kuzmin and V. Hanla'
labellen:
 
PCIWin:
db 'Please remember to enable PCI Access to Applications in Setup Menu. '
db ' '
db 'PCI Version = '
db 'Last PCI Bus = '
db 'Quantity of devices = '
db ' '
db 'VenID DevID Bus# Dev# Rev Class Subclass Company Description '
db '----- ----- ---- ---- --- ----- -------- ------------------------------------------ ----------------'
db 'x'
 
valor dw ?
r db ?
cur dw ?
total db ?
address dd ?
listcount db ?
V_Bus db 0
V_Dev db 0
PCI_Version dw 0
PCI_LastBus db 0
PCI_Device dw 0
PCI_Vendor dw 0
PCI_Bus db 0
PCI_Dev db 0
PCI_Rev db 0
PCI_Class db 0
PCI_SubClass db 0
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pcidev/trunk/vendors.inc
0,0 → 1,2004
; AUTHOR: Victor Alberto Gil Hancco Laquita <vhanla@gmail.com>
; This list might content mistakes, plz report it
; There are 865 Lists of Vendors' Names
; Date: 8/14/2005
;
; IN CONCLUSION, IF THERE EXISTS BUGS, PLEASE HELP THE PROJECT...
; maybe this list is outdated...
; (the source was from 2004 list)
 
_FIRSTPART: ;lists the 255 Vendor IDs
db 'PARADYNE CORP. '
dw 51 ; 0x0033
db 'REAL 3D '
dw 61 ; 0x003D
db 'NCIPHER CORP. LTD '
dw 256 ; 0x0100
db 'BREA TECHNOLOGIES INC '
dw 2697 ; 0x0A89
db 'COMPAQ COMPUTER CORP. '
dw 3601 ; 0x0E11
db 'SYMBIOS LOGIC INC/LSI Logic '
dw 4096 ; 0x1000
db 'KOLTER ELECTRONIC '
dw 4097 ; 0x1001
db 'ATI TECHNOLOGIES INC '
dw 4098 ; 0x1002
db 'VLSI TECHNOLOGY INC '
dw 4100 ; 0x1004
db 'NATIONAL SEMICONDUCTOR CORPORATION '
dw 4107 ; 0x100B
db 'VIDEO LOGIC LTD '
dw 4112 ; 0x1010
db 'IBM '
dw 4116 ; 0x1014
db 'UNISYS CORPORATION '
dw 4120 ; 0x1018
db 'ELITEGROUP COMPUTER SYS '
dw 4121 ; 0x1019
db 'NCR '
dw 4122 ; 0x101A
db 'AMERICAN MEGATRENDS '
dw 4126 ; 0x101E
db 'HITACHI COMPUTER PRODUCTS '
dw 4128 ; 0x1020
db 'OKI ELECTRIC INDUSTRY CO. LTD. '
dw 4129 ; 0x1021
db 'ADVANCED MICRO DEVICES '
dw 4130 ; 0x1022
db 'TRIDENT MICROSYSTEMS '
dw 4131 ; 0x1023
db 'DELL COMPUTER CORPORATION '
dw 4136 ; 0x1028
db 'LSI LOGIC CORPORATION '
dw 4138 ; 0x102A
db 'MATROX GRAPHICS. '
dw 4139 ; 0x102B
db 'TOSHIBA AMERICA '
dw 4143 ; 0x102F
db 'NEC CORPORATION '
dw 4147 ; 0x1033
db 'AMP '
dw 4152 ; 0x1038
db 'SILICON INTEGRATED SYSTEMS '
dw 4153 ; 0x1039
db 'SYNOPSYS/LOGIC MODELING GROUP '
dw 4159 ; 0x103F
db 'Micron Electronics. '
dw 4162 ; 0x1042
db 'ASUSTEK COMPUTER. '
dw 4163 ; 0x1043
db 'DISTRIBUTED PROCESSING TECHNOLOGY '
dw 4164 ; 0x1044
db 'OPTI INC. '
dw 4165 ; 0x1045
db 'ELSA AG '
dw 4168 ; 0x1048
db 'FOUNTAIN TECHNOLOGIES. '
dw 4169 ; 0x1049
db 'TEXAS INSTRUMENTS '
dw 4172 ; 0x104C
db 'SONY CORPORATION '
dw 4173 ; 0x104D
db 'WINBOND ELECTRONICS CORP '
dw 4176 ; 0x1050
db 'HITACHI '
dw 4180 ; 0x1054
db 'Standard Microsystems Corp. '
dw 4181 ; 0x1055
db 'ETRI '
dw 4184 ; 0x1058
db 'TEKNOR INDUSTRIAL COMPUTERS INC '
dw 4185 ; 0x1059
db 'PROMISE TECHNOLOGY. '
dw 4186 ; 0x105A
db 'FOXCONN INTERNATIONAL INC '
dw 4187 ; 0x105B
db 'NUMBER 9 VISUAL TECHNOLOGY '
dw 4189 ; 0x105D
db 'INFOTRONIC AMERICA INC '
dw 4191 ; 0x105F
db 'OCEAN MANUFACTURING LTD '
dw 4195 ; 0x1063
db 'ALCATEL '
dw 4196 ; 0x1064
db 'MITSUBISHI ELECTRIC AMERICA '
dw 4199 ; 0x1067
db 'DIVERSIFIED TECHNOLOGY '
dw 4200 ; 0x1068
db 'MYLEX CORPORATION '
dw 4201 ; 0x1069
db 'APPLE COMPUTER INC. '
dw 4203 ; 0x106B
db 'SEQUENT COMPUTER SYSTEMS '
dw 4205 ; 0x106D
db 'DAEWOO TELECOM LTD '
dw 4208 ; 0x1070
db 'MITAC '
dw 4209 ; 0x1071
db 'YAMAHA CORPORATION '
dw 4211 ; 0x1073
db 'QLOGIC '
dw 4215 ; 0x1077
db 'I-BUS '
dw 4217 ; 0x1079
db 'GATEWAY 2000 '
dw 4219 ; 0x107B
db 'INTERPHASE CORPORATION '
dw 4222 ; 0x107E
db 'OLICOM '
dw 4237 ; 0x108D
db 'SILICON IMAGE (WAS CMD TECHNOLOGY INC) '
dw 4245 ; 0x1095
db 'ALACRON '
dw 4246 ; 0x1096
db 'APPIAN/ETMA '
dw 4247 ; 0x1097
db 'PACKARD BELL NEC '
dw 4250 ; 0x109A
db 'BROOKTREE CORPORATION '
dw 4254 ; 0x109E
db 'TRIGEM COMPUTER INC. '
dw 4255 ; 0x109F
db 'MEIDENSHA CORPORATION '
dw 4256 ; 0x10A0
db 'QUANTUM EFFECT DESIGN '
dw 4258 ; 0x10A2
db 'SILICON GRAPHICS '
dw 4265 ; 0x10A9
db 'HONEYWELL IAC '
dw 4268 ; 0x10AC
db 'MICRO COMPUTER SYSTEMS INC '
dw 4271 ; 0x10AF
db 'PLX TECHNOLOGY. '
dw 4277 ; 0x10B5
db 'MADGE NETWORKS '
dw 4278 ; 0x10B6
db '3COM '
dw 4279 ; 0x10B7
db 'ACER LABS '
dw 4281 ; 0x10B9
db 'MITSUBISHI ELECTRIC CORP. '
dw 4282 ; 0x10BA
db 'AUSPEX SYSTEMS INC. '
dw 4290 ; 0x10C2
db 'NEOMAGIC CORPORATION '
dw 4296 ; 0x10C8
db 'FUJITSU MICROELECTRONIC '
dw 4298 ; 0x10CA
db 'OMRON CORPORATION '
dw 4299 ; 0x10CB
db 'ADVANCED SYSTEM PRODUCTS '
dw 4301 ; 0x10CD
db 'FUJITSU LIMITED '
dw 4303 ; 0x10CF
db 'FUTUREPLUS SYSTEMS CORP. '
dw 4305 ; 0x10D1
db 'MOLEX INCORPORATED '
dw 4306 ; 0x10D2
db 'ROHM LSI SYSTEMS '
dw 4315 ; 0x10DB
db 'EVANS & SUTHERLAND '
dw 4317 ; 0x10DD
db 'NVIDIA CORPORATION '
dw 4318 ; 0x10DE
db 'EMULEX CORPORATION '
dw 4319 ; 0x10DF
db 'TEKRAM TECHNOLOGY CO.LTD. '
dw 4321 ; 0x10E1
db 'TUNDRA SEMICONDUCTOR CORP '
dw 4323 ; 0x10E3
db 'MICRO INDUSTRIES CORPORATION '
dw 4325 ; 0x10E5
db 'REALTEK SEMICONDUCTOR CORP. '
dw 4332 ; 0x10EC
db 'XILINX. '
dw 4334 ; 0x10EE
db 'TYAN COMPUTER '
dw 4337 ; 0x10F1
db 'NKK CORPORATION '
dw 4341 ; 0x10F5
db 'CREATIVE ELECTRONIC SYSTEMS SA '
dw 4342 ; 0x10F6
db 'I-O DATA DEVICE. '
dw 4348 ; 0x10FC
db 'FAST MULTIMEDIA AG '
dw 4350 ; 0x10FE
db 'INITIO CORPORATION '
dw 4353 ; 0x1101
db 'CREATIVE LABS '
dw 4354 ; 0x1102
db 'SIGMA DESIGNS '
dw 4357 ; 0x1105
db 'VIA TECHNOLOGIES. '
dw 4358 ; 0x1106
db 'ASCEND COMMUNICATIONS. '
dw 4359 ; 0x1107
db 'Adaptec/Cogent Data Technologies Inc '
dw 4361 ; 0x1109
db 'SIEMENS PC SYSTEME GMBH '
dw 4362 ; 0x110A
db 'SANTA CRUZ OPERATION '
dw 4369 ; 0x1111
db 'ACCTON TECHNOLOGY '
dw 4371 ; 0x1113
db 'MEDIA 100 '
dw 4374 ; 0x1116
db 'DATACUBE '
dw 4375 ; 0x1117
db 'FCI ELECTRONICS '
dw 4376 ; 0x1118
db 'ICP-VORTEX COMPUTERSYSTEM GMBH '
dw 4377 ; 0x1119
db 'EFFICIENT NETWORKS '
dw 4378 ; 0x111A
db 'INTEGRATED DEVICE TECH '
dw 4381 ; 0x111D
db 'EMC CORPORATION '
dw 4384 ; 0x1120
db 'FORE SYSTEMS INC '
dw 4391 ; 0x1127
db 'HERMES ELECTRONICS COMPANY '
dw 4394 ; 0x112A
db 'IMAGING TECHNOLOGY '
dw 4399 ; 0x112F
db 'PHILIPS SEMICONDUCTORS '
dw 4401 ; 0x1131
db 'MITEL CORP '
dw 4402 ; 0x1132
db 'EICON TECHNOLOGY CORPORATION '
dw 4403 ; 0x1133
db 'MERCURY COMPUTER SYSTEMS '
dw 4404 ; 0x1134
db 'FUJI XEROX CO LTD '
dw 4405 ; 0x1135
db 'MOMENTUM DATA SYSTEMS '
dw 4406 ; 0x1136
db 'CISCO SYSTEMS INC '
dw 4407 ; 0x1137
db 'ZIATECH CORPORATION '
dw 4408 ; 0x1138
db 'CYCLONE MICROSYSTEMS. '
dw 4412 ; 0x113C
db 'SANYO ELECTRIC CO-Information Systems Division '
dw 4414 ; 0x113E
db 'CREST MICROSYSTEM INC. '
dw 4417 ; 0x1141
db 'WORKBIT CORPORATION '
dw 4421 ; 0x1145
db 'FORCE COMPUTERS GMBH '
dw 4422 ; 0x1146
db 'SYSKONNECT '
dw 4424 ; 0x1148
db 'ANNABOOKS '
dw 4428 ; 0x114C
db 'DIGI INTERNATIONAL '
dw 4431 ; 0x114F
db 'MELCO INC '
dw 4436 ; 0x1154
db 'PHOTRON LTD. '
dw 4444 ; 0x115C
db 'XIRCOM '
dw 4445 ; 0x115D
db 'PFU LIMITED '
dw 4449 ; 0x1161
db 'RENDITION '
dw 4451 ; 0x1163
db 'Reliance Computer '
dw 4454 ; 0x1166
db 'ELECTRONICS FOR IMAGING '
dw 4462 ; 0x116E
db 'INVENTEC CORPORATION '
dw 4464 ; 0x1170
db 'BLUE WAVE SYSTEMS '
dw 4465 ; 0x1171
db 'ALTERA CORPORATION '
dw 4466 ; 0x1172
db 'TOSHIBA AMERICA INFO SYSTEMS '
dw 4473 ; 0x1179
db 'RICOH CO LTD '
dw 4480 ; 0x1180
db 'D-LINK SYSTEM INC '
dw 4486 ; 0x1186
db 'ADVANCED TECHNOLOGY LABORATORIES '
dw 4487 ; 0x1187
db 'MATSUSHITA ELECTIC INDUSTRIAL CO LTD '
dw 4489 ; 0x1189
db 'PLATYPUS TECHNOLOGY PTY LTD '
dw 4491 ; 0x118B
db 'COROLLARY '
dw 4492 ; 0x118C
db 'ACARD TECHNOLOGY '
dw 4497 ; 0x1191
db 'RATOC SYSTEMS INC '
dw 4501 ; 0x1195
db 'MINDSHARE. '
dw 4506 ; 0x119A
db 'BUG. '
dw 4509 ; 0x119D
db 'FUJITSU MICROELECTRONICS LTD. '
dw 4510 ; 0x119E
db 'BULL HN INFORMATION SYSTEMS '
dw 4511 ; 0x119F
db 'HAMAMATSU PHOTONICS K.K. '
dw 4513 ; 0x11A1
db 'INNOSYS '
dw 4521 ; 0x11A9
db 'ACTEL '
dw 4522 ; 0x11AA
db 'GALILEO TECHNOLOGY LTD. '
dw 4523 ; 0x11AB
db 'LITE-ON COMMUNICATIONS INC '
dw 4525 ; 0x11AD
db 'SCITEX CORPORATION '
dw 4526 ; 0x11AE
db 'AVID TECHNOLOGY INC '
dw 4527 ; 0x11AF
db 'V3 SEMICONDUCTOR INC. '
dw 4528 ; 0x11B0
db 'EASTMAN KODAK '
dw 4530 ; 0x11B2
db 'BARR SYSTEMS INC. '
dw 4531 ; 0x11B3
db 'ASTRODESIGN '
dw 4543 ; 0x11BF
db 'DAINIPPON SCREEN MFG. CO. LTD '
dw 4550 ; 0x11C6
db 'DOLPHIN INTERCONNECT SOLUTIONS AS '
dw 4552 ; 0x11C8
db 'MAGMA '
dw 4553 ; 0x11C9
db 'LSI SYSTEMS '
dw 4554 ; 0x11CA
db 'SPECIALIX INTERNATIONAL LTD '
dw 4555 ; 0x11CB
db 'NETACCESS '
dw 4558 ; 0x11CE
db 'LOCKHEED MARTIN-Electronics & Communications '
dw 4560 ; 0x11D0
db 'AURAVISION '
dw 4561 ; 0x11D1
db 'INTERCOM INC. '
dw 4562 ; 0x11D2
db 'ANALOG DEVICES '
dw 4564 ; 0x11D4
db 'IKON CORPORATION '
dw 4565 ; 0x11D5
db 'TOSHIBA TEC CORPORATION '
dw 4569 ; 0x11D9
db 'NOVELL '
dw 4570 ; 0x11DA
db 'NEW WAVE PDG '
dw 4575 ; 0x11DF
db 'QUICKLOGIC CORPORATION '
dw 4579 ; 0x11E3
db 'CORECO INC '
dw 4588 ; 0x11EC
db 'DOME IMAGING SYSTEMS INC '
dw 4590 ; 0x11EE
db 'PMC-SIERRA INC '
dw 4600 ; 0x11F8
db 'AGFA CORPORATION '
dw 4611 ; 0x1203
db 'AMDAHL CORPORATION '
dw 4614 ; 0x1206
db 'ESSENTIAL COMMUNICATIONS '
dw 4623 ; 0x120F
db 'PERFORMANCE TECHNOLOGIES. '
dw 4628 ; 0x1214
db 'PURUP-EskoFot A/S '
dw 4630 ; 0x1216
db 'O2MICRO. '
dw 4631 ; 0x1217
db '3DFX INTERACTIVE '
dw 4634 ; 0x121A
db 'VIRATA LTD '
dw 4635 ; 0x121B
db 'CONTEC CO. LTD '
dw 4641 ; 0x1221
db 'ARTESYN COMMUNICATIONS PRODUCTS INC '
dw 4643 ; 0x1223
db 'TECH-SOURCE '
dw 4647 ; 0x1227
db 'SICAN GMBH '
dw 4652 ; 0x122C
db 'MARCONI COMMUNICATIONS LTD '
dw 4658 ; 0x1232
db 'SOLITON SYSTEMS K.K. '
dw 4961 ; 0x1361
db 'CENTURY SYSTEMS. '
dw 4668 ; 0x123C
db 'ENGINEERING DESIGN TEAM. '
dw 4669 ; 0x123D
db 'C-CUBE MICROSYSTEMS '
dw 4671 ; 0x123F
db 'JAYCOR NETWORKS INC. '
dw 4674 ; 0x1242
db 'AVM AUDIOVISUELLES MKTG & COMPUTER SYSTEM GMBH '
dw 4676 ; 0x1244
db 'SBS TECHNOLOGIES '
dw 4683 ; 0x124B
db 'HITACHI ULSI SYSTEMS CO LTD '
dw 4688 ; 0x1250
db 'GUZIK TECHNICAL ENTERPRISES '
dw 4691 ; 0x1253
db 'OPTIBASE LTD '
dw 4693 ; 0x1255
db 'ALLIED TELESYN INTERNATIONAL '
dw 4697 ; 0x1259
db 'AURORA TECHNOLOGIES. '
dw 4700 ; 0x125C
db 'CONCURRENT TECHNOLOGIES '
dw 4703 ; 0x125F
db 'INTERSIL CORP '
dw 4704 ; 0x1260
db 'MATSUSHITA-KOTOBUKI ELECTRONICS '
dw 4705 ; 0x1261
db 'AVAL NAGASAKI CORPORATION '
dw 4708 ; 0x1264
db 'TEKTRONIX '
dw 4712 ; 0x1268
db 'NORTEL NETWORKS '
dw 4716 ; 0x126C
db 'SPLASH TECHNOLOGY. '
dw 4717 ; 0x126D
db 'SUMITOMO METAL INDUSTRIES '
dw 4718 ; 0x126E
db 'SILICON MOTION. '
dw 4719 ; 0x126F
db 'OLYMPUS OPTICAL CO. LTD. '
dw 4720 ; 0x1270
db 'CREATIVE LABS (WAS ENSONIQ, MALVERN) '
dw 4724 ; 0x1274
db 'NETWORK APPLIANCE CORPORATION '
dw 4725 ; 0x1275
db 'TRANSTECH DSP LTD '
dw 4728 ; 0x1278
db 'TRANSMETA CORPORATION '
dw 4729 ; 0x1279
db 'VELA RESEARCH LP '
dw 4733 ; 0x127D
db 'FUJIFILM '
dw 4735 ; 0x127F
db 'YOKOGAWA ELECTRIC CORPORATION '
dw 4737 ; 0x1281
db 'INTEGRATED TECHNOLOGY EXPRESS. '
dw 4739 ; 0x1283
db 'MAZET GMBH '
dw 4742 ; 0x1286
db 'TRANSWITCH CORPORATION '
dw 4747 ; 0x128B
db 'G2 NETWORKS. '
dw 4749 ; 0x128D
db 'TATENO DENNOU. '
dw 4751 ; 0x128F
db 'TOSHIBA PERSONAL COMPUTER SYSTEM CORP. '
dw 4752 ; 0x1290
db 'NCS COMPUTER ITALIA SRL '
dw 4753 ; 0x1291
db 'TRITECH MICROELECTRONICS INC '
dw 4754 ; 0x1292
db 'SHUTTLE COMPUTER '
dw 4759 ; 0x1297
db 'KNOWLEDGE TECHNOLOGY LAB. '
dw 4761 ; 0x1299
db 'VMETRO. '
dw 4762 ; 0x129A
db 'VICTOR COMPANY OF JAPAN '
dw 4766 ; 0x129E
db 'ALLEN- BRADLEY COMPANY '
dw 4768 ; 0x12A0
db 'LUCENT TECHNOLOGIES '
dw 4771 ; 0x12A3
db 'AMO GMBH '
dw 4775 ; 0x12A7
db 'XIOTECH CORPORATION '
dw 4777 ; 0x12A9
db 'YUAN YUAN ENTERPRISE CO. LTD. '
dw 4779 ; 0x12AB
db 'ALTEON WEBSYSTEMS INC '
dw 4782 ; 0x12AE
db 'NATURAL MICROSYSTEMS '
dw 4790 ; 0x12B6
db 'COGNEX MODULAR VISION SYSTEMS DIV.-ACUMEN INC. '
dw 4791 ; 0x12B7
db '3Com '
dw 4793 ; 0x12B9
db 'ARRAY MICROSYSTEMS '
dw 4796 ; 0x12BC
db 'ANCHOR CHIPS INC. '
dw 4798 ; 0x12BE
db 'Fujifilm Microdevices '
dw 4799 ; 0x12BF
db 'INFIMED '
dw 4800 ; 0x12C0
db 'HOLTEK SEMICONDUCTOR INC '
dw 4803 ; 0x12C3
db 'Connect Tech Inc '
dw 4804 ; 0x12C4
db 'Mitan Corporation '
dw 4806 ; 0x12C6
_SECONDPART: ;lists 255 Vendors
db 'Dialogic Corp '
dw 4807 ; 0x12C7
db 'Integrated Computing Engines '
dw 4810 ; 0x12CA
db 'Aims Lab '
dw 4813 ; 0x12CD
db 'GE VINGMED ULTRASOUND AS '
dw 4819 ; 0x12D3
db 'COMVERSE NETWORKS SYSTEM & Ulticom. '
dw 4820 ; 0x12D4
db 'Equator Technologies '
dw 4821 ; 0x12D5
db 'Analogic Corp '
dw 4822 ; 0x12D6
db 'PERICOM SEMICONDUCTOR '
dw 4824 ; 0x12D8
db 'Aculab PLC '
dw 4825 ; 0x12D9
db 'True Time Inc. '
dw 4826 ; 0x12DA
db 'Rainbow Technologies '
dw 4830 ; 0x12DE
db 'SBS Technologies Inc '
dw 4831 ; 0x12DF
db 'Chase Research '
dw 4832 ; 0x12E0
db 'Datum Inc. Bancomm-Timing Division '
dw 4834 ; 0x12E2
db 'Brooktrout Technology Inc '
dw 4836 ; 0x12E4
db 'Sebring Systems '
dw 4839 ; 0x12E7
db 'Real Vision '
dw 4842 ; 0x12EA
db 'AUREAL INC. '
dw 4843 ; 0x12EB
db '3A '
dw 4844 ; 0x12EC
db 'PENTEK '
dw 4848 ; 0x12F0
db 'COGNEX INC. '
dw 4855 ; 0x12F7
db 'Spectrum Signal Processing '
dw 4859 ; 0x12FB
db 'CAPITAL EQUIPMENT CORP '
dw 4860 ; 0x12FC
db 'ESD Electronic System Design GmbH '
dw 4862 ; 0x12FE
db 'Juniper Networks Inc. '
dw 4868 ; 0x1304
db 'Computer Boards '
dw 4871 ; 0x1307
db 'LEVEL ONE COMMUNICATIONS '
dw 4872 ; 0x1308
db 'Mitsubishi Electric MicroComputer '
dw 4874 ; 0x130A
db 'Colorgraphic Communications Corp '
dw 4875 ; 0x130B
db 'Advanet Inc '
dw 4879 ; 0x130F
db 'GESPAC '
dw 4880 ; 0x1310
db 'YASKAWA ELECTRIC CO. '
dw 4883 ; 0x1313
db 'TERADYNE INC. '
dw 4886 ; 0x1316
db 'ADMTEK INC '
dw 4887 ; 0x1317
db 'Packet Engines Inc. '
dw 4888 ; 0x1318
db 'ForteMedia '
dw 4889 ; 0x1319
db 'SIIG Inc '
dw 4895 ; 0x131F
db 'SALIX TECHNOLOGIES INC '
dw 4901 ; 0x1325
db 'SeaChange International '
dw 4902 ; 0x1326
db 'RadiSys Corp. '
dw 4913 ; 0x1331
db 'PRISA NETWORKS '
dw 4925 ; 0x133D
db 'SCM MICROSYSTEMS '
dw 4927 ; 0x133F
db 'PROMAX SYSTEMS INC '
dw 4930 ; 0x1342
db 'MICRON TECHNOLOGY INC '
dw 4932 ; 0x1344
db 'ARK RESEARCH CORP. '
dw 4939 ; 0x134B
db 'CHORI JOHO SYSTEM CO. LTD '
dw 4940 ; 0x134C
db 'PC-TEL INC '
dw 4941 ; 0x134D
db 'BRAIN BOXES LIMITED '
dw 4954 ; 0x135A
db 'QUATECH INC '
dw 4956 ; 0x135C
db 'SEALEVEL SYSTEMS INC '
dw 4958 ; 0x135E
db 'I-DATA INTERNATIONAL A-S '
dw 4959 ; 0x135F
db 'MEINBERG FUNKUHREN '
dw 4960 ; 0x1360
db 'PHOENIX TECHNOLOGIES LTD '
dw 4963 ; 0x1363
db 'HITACHI ZOSEN CORPORATION '
dw 4967 ; 0x1367
db 'SKYWARE CORPORATION '
dw 4968 ; 0x1368
db 'DIGIGRAM '
dw 4969 ; 0x1369
db 'KAWASAKI STEEL CORPORATION '
dw 4971 ; 0x136B
db 'ADTEK SYSTEM SCIENCE CO LTD '
dw 4972 ; 0x136C
db 'BOEING-SUNNYVALE '
dw 4981 ; 0x1375
db 'ELECTRONIC EQUIPMENT PRODUCTION & DISTRIBUTION '
dw 4983 ; 0x1377
db 'MARK OF THE UNICORN INC '
dw 4986 ; 0x137A
db 'PPT VISION '
dw 4987 ; 0x137B
db 'IWATSU ELECTRIC CO LTD '
dw 4988 ; 0x137C
db 'DYNACHIP CORPORATION '
dw 4989 ; 0x137D
db 'SANRITZ AUTOMATION CO LTC '
dw 4992 ; 0x1380
db 'BRAINS CO. LTD '
dw 4993 ; 0x1381
db 'CONTROLNET INC '
dw 4995 ; 0x1383
db 'STELLAR SEMICONDUCTOR INC '
dw 4996 ; 0x1384
db 'NETGEAR '
dw 4997 ; 0x1385
db 'SYSTRAN CORP '
dw 4999 ; 0x1387
db 'HITACHI INFORMATION TECHNOLOGY CO LTD '
dw 5000 ; 0x1388
db 'APPLICOM INTERNATIONAL '
dw 5001 ; 0x1389
db 'SITERA '
dw 5002 ; 0x138A
db 'TOKIMEC INC '
dw 5003 ; 0x138B
db 'BASLER GMBH '
dw 5006 ; 0x138E
db 'PATAPSCO DESIGNS INC '
dw 5007 ; 0x138F
db 'MOXA TECHNOLOGIES CO LTD '
dw 5011 ; 0x1393
db 'LEVEL ONE COMMUNICATIONS '
dw 5012 ; 0x1394
db 'AMBICOM INC '
dw 5013 ; 0x1395
db 'CIPHER SYSTEMS INC '
dw 5014 ; 0x1396
db 'COLOGNE CHIP DESIGNS GMBH '
dw 5015 ; 0x1397
db 'CLARION CO. LTD '
dw 5016 ; 0x1398
db 'RIOS SYSTEMS CO LTD '
dw 5017 ; 0x1399
db 'ALACRITECH INC '
dw 5018 ; 0x139A
db 'QUANTUM 3D INC '
dw 5020 ; 0x139C
db 'XSTREAMS PLC/ EPL LIMITED '
dw 5021 ; 0x139D
db 'ECHOSTAR DATA NETWORKS '
dw 5022 ; 0x139E
db 'AETHRA S.R.L. '
dw 5023 ; 0x139F
db 'CRYSTAL GROUP INC '
dw 5024 ; 0x13A0
db 'KAWASAKI HEAVY INDUSTRIES LTD '
dw 5025 ; 0x13A1
db 'OSITECH COMMUNICATIONS INC '
dw 5026 ; 0x13A2
db 'RASCOM INC '
dw 5028 ; 0x13A4
db 'TELES AG '
dw 5031 ; 0x13A7
db 'EXAR CORP. '
dw 5032 ; 0x13A8
db 'SIEMENS MEDICAL SYSTEMS '
dw 5033 ; 0x13A9
db 'NORTEL NETWORKS-BWA DIVISION '
dw 5034 ; 0x13AA
db 'T.SQWARE '
dw 5039 ; 0x13AF
db 'TAMURA CORPORATION '
dw 5041 ; 0x13B1
db 'WELLBEAN CO INC '
dw 5044 ; 0x13B4
db 'ARM Ltd '
dw 5045 ; 0x13B5
db 'DLoG GMBH '
dw 5046 ; 0x13B6
db 'NOKIA TELECOMMUNICATIONS OY '
dw 5048 ; 0x13B8
db 'SHARP CORPORATION '
dw 5053 ; 0x13BD
db 'SHAREWAVE INC '
dw 5055 ; 0x13BF
db '3WARE '
dw 5057 ; 0x13C1
db 'TECHNOTREND SYSTEMTECHNIK GMBH '
dw 5058 ; 0x13C2
db 'JANZ COMPUTER AG '
dw 5059 ; 0x13C3
db 'CONDOR ENGINEERING INC '
dw 5062 ; 0x13C6
db 'BLUE CHIP TECHNOLOGY LTD '
dw 5063 ; 0x13C7
db 'IOMEGA CORPORATION '
dw 5066 ; 0x13CA
db 'METHEUS CORPORATION '
dw 5068 ; 0x13CC
db 'STUDIO AUDIO & VIDEO LTD '
dw 5071 ; 0x13CF
db 'B2C2 '
dw 5072 ; 0x13D0
db 'ABOCOM SYSTEMS '
dw 5073 ; 0x13D1
db 'SHARK MULTIMEDIA INC '
dw 5074 ; 0x13D2
db 'IMC NETWORKS '
dw 5075 ; 0x13D3
db 'GRAPHICS MICROSYSTEMS INC '
dw 5076 ; 0x13D4
db 'K.I. TECHNOLOGY CO LTD '
dw 5078 ; 0x13D6
db 'TOSHIBA ENGINEERING CORPORATION '
dw 5079 ; 0x13D7
db 'PHOBOS CORPORATION '
dw 5080 ; 0x13D8
db 'APEX INC '
dw 5081 ; 0x13D9
db 'NETBOOST CORPORATION '
dw 5084 ; 0x13DC
db 'ABB ROBOTICS PRODUCTS '
dw 5086 ; 0x13DE
db 'E-TECH INC '
dw 5087 ; 0x13DF
db 'GVC CORPORATION '
dw 5088 ; 0x13E0
db 'NEST INC '
dw 5091 ; 0x13E3
db 'CALCULEX INC '
dw 5092 ; 0x13E4
db 'TELESOFT DESIGN LTD '
dw 5093 ; 0x13E5
db 'INTRASERVER TECHNOLOGY INC '
dw 5097 ; 0x13E9
db 'DALLAS SEMICONDUCTOR '
dw 5098 ; 0x13EA
db 'SUNDANCE TECHNOLOGY INC '
dw 5104 ; 0x13F0
db 'OCE-TECHNOLOGIES B.V. '
dw 5105 ; 0x13F1
db 'FORD MICROELECTRONICS INC '
dw 5106 ; 0x13F2
db 'TROIKA NETWORKS INC '
dw 5108 ; 0x13F4
db 'C-MEDIA ELECTRONICS INC '
dw 5110 ; 0x13F6
db 'NTT ADVANCED TECHNOLOGY CORP. '
dw 5113 ; 0x13F9
db 'AYDIN CORP '
dw 5115 ; 0x13FB
db 'MICRO SCIENCE INC '
dw 5117 ; 0x13FD
db 'ARTX INC '
dw 5120 ; 0x1400
db 'MEILHAUS ELECTRONIC GmbH '
dw 5122 ; 0x1402
db 'FUNDAMENTAL SOFTWARE INC '
dw 5124 ; 0x1404
db 'OCE PRINTING SYSTEMS GmbH '
dw 5126 ; 0x1406
db 'LAVA COMPUTER MFG INC '
dw 5127 ; 0x1407
db 'ALOKA CO. LTD '
dw 5128 ; 0x1408
db 'DSP RESEARCH INC '
dw 5130 ; 0x140A
db 'RAMIX INC '
dw 5131 ; 0x140B
db 'MATSUSHITA ELECTRIC WORKS LTD '
dw 5133 ; 0x140D
db 'ADDONICS '
dw 5139 ; 0x1413
db 'OXFORD SEMICONDUCTOR LTD '
dw 5141 ; 0x1415
db 'KYUSHU ELECTRONICS SYSTEMS INC '
dw 5144 ; 0x1418
db 'EXCEL SWITCHING CORP '
dw 5145 ; 0x1419
db 'ZOOM TELEPHONICS INC '
dw 5147 ; 0x141B
db 'FANUC LTD '
dw 5150 ; 0x141E
db 'PSION DACOM PLC '
dw 5152 ; 0x1420
db 'EDEC CO LTD '
dw 5160 ; 0x1428
db 'UNEX TECHNOLOGY CORP '
dw 5161 ; 0x1429
db 'KINGMAX TECHNOLOGY INC '
dw 5162 ; 0x142A
db 'RADIOLAN '
dw 5163 ; 0x142B
db 'MINTON OPTIC INDUSTRY CO LTD '
dw 5164 ; 0x142C
db 'PIXSTREAM INC '
dw 5165 ; 0x142D
db 'ITT AEROSPACE/COMMUNICATIONS DIVISION '
dw 5168 ; 0x1430
db 'ELTEC ELEKTRONIK GMBH '
dw 5171 ; 0x1433
db 'CIS TECHNOLOGY INC '
dw 5174 ; 0x1436
db 'NISSIN INC CO '
dw 5175 ; 0x1437
db 'ATMEL-DREAM '
dw 5176 ; 0x1438
db 'LIGHTWELL CO LTD-ZAX DIVISION '
dw 5183 ; 0x143F
db 'AGIE SA '
dw 5185 ; 0x1441
db 'LOGICAL CO LTD '
dw 5189 ; 0x1445
db 'GRAPHIN CO. LTD '
dw 5190 ; 0x1446
db 'AIM GMBH '
dw 5191 ; 0x1447
db 'ADLINK TECHNOLOGY '
dw 5194 ; 0x144A
db 'LORONIX INFORMATION SYSTEMS INC '
dw 5195 ; 0x144B
db 'SAMSUNG ELECTRONICS CO LTD '
dw 5197 ; 0x144D
db 'OCTAVE COMMUNICATIONS IND. '
dw 5200 ; 0x1450
db 'SP3D CHIP DESIGN GMBH '
dw 5201 ; 0x1451
db 'MYCOM INC '
dw 5203 ; 0x1453
db 'LOGIC PLUS PLUS INC '
dw 5205 ; 0x1455
db 'GIGA-BYTE TECHNOLOGY '
dw 5208 ; 0x1458
db 'CRYPTEK '
dw 5212 ; 0x145C
db 'BALDOR ELECTRIC COMPANY '
dw 5215 ; 0x145F
db 'DYNARC INC '
dw 5216 ; 0x1460
db 'MICRO-STAR INTERNATIONAL CO LTD '
dw 5218 ; 0x1462
db 'FAST CORPORATION '
dw 5219 ; 0x1463
db 'INTERACTIVE CIRCUITS & SYSTEMS LTD '
dw 5220 ; 0x1464
db 'GN NETTEST TELECOM DIV. '
dw 5221 ; 0x1465
db 'AMBIT MICROSYSTEMS CORP. '
dw 5224 ; 0x1468
db 'CLEVELAND MOTION CONTROLS '
dw 5225 ; 0x1469
db 'RUBY TECH CORP. '
dw 5228 ; 0x146C
db 'TACHYON. '
dw 5229 ; 0x146D
db 'WILLIAMS ELECTRONICS GAMES. '
dw 5230 ; 0x146E
db 'INTEGRATED TELECOM EXPRESS INC '
dw 5233 ; 0x1471
db 'ZAPEX TECHNOLOGIES INC '
dw 5235 ; 0x1473
db 'DOUG CARSON & ASSOCIATES '
dw 5236 ; 0x1474
db 'NET INSIGHT '
dw 5239 ; 0x1477
db 'DIATREND CORPORATION '
dw 5240 ; 0x1478
db 'ABIT '
dw 5243 ; 0x147B
db 'NIHON UNISYS '
dw 5247 ; 0x147F
db 'ISYTEC-Integrierte Systemtechnik Gmbh '
dw 5250 ; 0x1482
db 'LABWAY COPORATION '
dw 5251 ; 0x1483
db 'ERMA-ELECTRONIC GMBH '
dw 5253 ; 0x1485
db 'KYE SYSTEMS CORPORATION '
dw 5257 ; 0x1489
db 'OPTO 22 '
dw 5258 ; 0x148A
db 'INNOMEDIALOGIC INC. '
dw 5259 ; 0x148B
db 'OSI PLUS CORPORATION '
dw 5262 ; 0x148E
db 'PLANT EQUIPMENT. '
dw 5263 ; 0x148F
db 'TC LABS PTY LTD. '
dw 5264 ; 0x1490
db 'MAKER COMMUNICATIONS '
dw 5267 ; 0x1493
db 'TOKAI COMMUNICATIONS INDUSTRY CO. LTD '
dw 5269 ; 0x1495
db 'JOYTECH COMPUTER CO. LTD. '
dw 5270 ; 0x1496
db 'SMA REGELSYSTEME GMBH '
dw 5271 ; 0x1497
db 'EMTEC CO. LTD '
dw 5273 ; 0x1499
db 'ANDOR TECHNOLOGY LTD '
dw 5274 ; 0x149A
db 'SEIKO INSTRUMENTS INC '
dw 5275 ; 0x149B
db 'OVISLINK CORP. '
dw 5276 ; 0x149C
db 'NEWTEK INC '
dw 5277 ; 0x149D
db 'MAPLETREE NETWORKS INC. '
dw 5278 ; 0x149E
db 'LECTRON CO LTD '
dw 5279 ; 0x149F
db 'SOFTING GMBH '
dw 5280 ; 0x14A0
db 'SYSTEMBASE CO LTD '
dw 5281 ; 0x14A1
db 'MILLENNIUM ENGINEERING INC '
dw 5282 ; 0x14A2
db 'MAVERICK NETWORKS '
dw 5283 ; 0x14A3
db 'GVC/BCM ADVANCED RESEARCH '
dw 5284 ; 0x14A4
db 'XIONICS DOCUMENT TECHNOLOGIES INC. '
dw 5285 ; 0x14A5
db 'INOVA COMPUTERS GMBH & CO KG '
dw 5286 ; 0x14A6
db 'FEATRON TECHNOLOGIES CORPORATION '
dw 5288 ; 0x14A8
db 'HIVERTEC INC. '
dw 5289 ; 0x14A9
db 'MENTOR GRAPHICS CORP. '
dw 5291 ; 0x14AB
db 'NOVAWEB TECHNOLOGIES INC '
dw 5292 ; 0x14AC
db 'TIME SPACE RADIO AB '
dw 5293 ; 0x14AD
db 'CTI PET Systems '
dw 5294 ; 0x14AE
db 'GUILLEMOT CORPORATION '
dw 5295 ; 0x14AF
db 'BST COMMUNICATION TECHNOLOGY LTD '
dw 5296 ; 0x14B0
db 'NEXTCOM K.K. '
dw 5297 ; 0x14B1
db 'ENNOVATE NETWORKS INC '
dw 5298 ; 0x14B2
db 'XPEED INC. '
dw 5299 ; 0x14B3
db 'PHILIPS BUSINESS ELECTRONICS B.V. '
dw 5300 ; 0x14B4
db 'CREAMWARE GMBH '
dw 5301 ; 0x14B5
db 'QUANTUM DATA CORP. '
dw 5302 ; 0x14B6
db 'PROXIM INC '
dw 5303 ; 0x14B7
db 'TECHSOFT TECHNOLOGY CO LTD '
dw 5304 ; 0x14B8
db 'AIRONET WIRELESS COMMUNICATIONS '
dw 5305 ; 0x14B9
db 'INTERNIX INC. '
dw 5306 ; 0x14BA
db 'SEMTECH CORPORATION '
dw 5307 ; 0x14BB
db 'GLOBESPAN SEMICONDUCTOR INC. '
dw 5308 ; 0x14BC
db 'CARDIO CONTROL N.V. '
dw 5309 ; 0x14BD
db 'L3 COMMUNICATIONS '
dw 5310 ; 0x14BE
db 'SPIDER COMMUNICATIONS INC. '
dw 5311 ; 0x14BF
db 'COMPAL ELECTRONICS INC '
dw 5312 ; 0x14C0
db 'MYRICOM INC. '
dw 5313 ; 0x14C1
db 'DTK COMPUTER '
dw 5314 ; 0x14C2
db 'MEDIATEK CORP. '
dw 5315 ; 0x14C3
db 'IWASAKI INFORMATION SYSTEMS CO LTD '
dw 5316 ; 0x14C4
db 'ABB AUTOMATION PRODUCTS '
dw 5317 ; 0x14C5
db 'DATA RACE INC '
dw 5318 ; 0x14C6
db 'MODULAR TECHNOLOY HOLDINGS LTD '
dw 5319 ; 0x14C7
_THIRDPART: ;lists 255 vendors
db 'TURBOCOMM TECH. INC. '
dw 5320 ; 0x14C8
db 'ODIN TELESYSTEMS INC '
dw 5321 ; 0x14C9
db 'PE LOGIC CORP. '
dw 5322 ; 0x14CA
db 'Billionton Systems Inc./Cadmus Micro Inc. '
dw 5323 ; 0x14CB
db 'NAKAYO TELECOMMUNICATIONS INC '
dw 5324 ; 0x14CC
db 'UNIVERSAL SCIENTIFIC IND '
dw 5325 ; 0x14CD
db 'WHISTLE COMMUNICATIONS '
dw 5326 ; 0x14CE
db 'TEK MICROSYSTEMS INC. '
dw 5327 ; 0x14CF
db 'ERICSSON AXE R & D '
dw 5328 ; 0x14D0
db 'COMPUTER HI-TECH CO LTD '
dw 5329 ; 0x14D1
db 'TITAN ELECTRONICS INC '
dw 5330 ; 0x14D2
db 'CIRTECH (UK) LTD '
dw 5331 ; 0x14D3
db 'PANACOM TECHNOLOGY CORP '
dw 5332 ; 0x14D4
db 'NITSUKO CORPORATION '
dw 5333 ; 0x14D5
db 'ACCUSYS '
dw 5334 ; 0x14D6
db 'HIRAKAWA HEWTECH CORP '
dw 5335 ; 0x14D7
db 'HOPF ELEKTRONIK GMBH '
dw 5336 ; 0x14D8
db 'ALPHA PROCESSOR INC '
dw 5337 ; 0x14D9
db 'NATIONAL AEROSPACE LABORATORIES '
dw 5338 ; 0x14DA
db 'AVLAB TECHNOLOGY INC '
dw 5339 ; 0x14DB
db 'AMPLICON LIVELINE LTD '
dw 5340 ; 0x14DC
db 'IMODL INC. '
dw 5341 ; 0x14DD
db 'APPLIED INTEGRATION CORPORATION '
dw 5342 ; 0x14DE
db 'BASIS COMMUNICATIONS CORP '
dw 5343 ; 0x14DF
db 'INVERTEX '
dw 5345 ; 0x14E1
db 'INFOLIBRIA '
dw 5346 ; 0x14E2
db 'AMTELCO '
dw 5347 ; 0x14E3
db 'BROADCOM CORPORATION '
dw 5348 ; 0x14E4
db 'PIXELFUSION LTD '
dw 5349 ; 0x14E5
db 'SHINING TECHNOLOGY INC '
dw 5350 ; 0x14E6
db '3CX '
dw 5351 ; 0x14E7
db 'RAYCER INC '
dw 5352 ; 0x14E8
db 'GARNETS SYSTEM CO LTD '
dw 5353 ; 0x14E9
db 'PLANEX COMMUNICATIONS INC '
dw 5354 ; 0x14EA
db 'SEIKO EPSON CORPORATION '
dw 5355 ; 0x14EB
db 'ACQIRIS '
dw 5356 ; 0x14EC
db 'DATAKINETICS LTD '
dw 5357 ; 0x14ED
db 'MASPRO KENKOH CORP '
dw 5358 ; 0x14EE
db 'CARRY COMPUTER ENG. CO LTD '
dw 5359 ; 0x14EF
db 'CANON RESEACH CENTRE FRANCE '
dw 5360 ; 0x14F0
db 'CONEXANT '
dw 5361 ; 0x14F1
db 'MOBILITY ELECTRONICS '
dw 5362 ; 0x14F2
db 'BROADLOGIC '
dw 5363 ; 0x14F3
db 'TOKYO ELECTRONIC INDUSTRY CO LTD '
dw 5364 ; 0x14F4
db 'SOPAC LTD '
dw 5365 ; 0x14F5
db 'COYOTE TECHNOLOGIES LLC '
dw 5366 ; 0x14F6
db 'WOLF TECHNOLOGY INC '
dw 5367 ; 0x14F7
db 'AUDIOCODES INC '
dw 5368 ; 0x14F8
db 'AG COMMUNICATIONS '
dw 5369 ; 0x14F9
db 'WAVETEK WANDEL & GOLTERMANN '
dw 5370 ; 0x14FA
db 'TRANSAS MARINE (UK) LTD '
dw 5371 ; 0x14FB
db 'QUADRICS SUPERCOMPUTERS WORLD '
dw 5372 ; 0x14FC
db 'JAPAN COMPUTER INDUSTRY INC. '
dw 5373 ; 0x14FD
db 'ARCHTEK TELECOM CORP. '
dw 5374 ; 0x14FE
db 'TWINHEAD INTERNATIONAL CORP '
dw 5375 ; 0x14FF
db 'LANTECH COMPUTER COMPANY '
dw 5376 ; 0x1500
db 'BANKSOFT CANADA LTD '
dw 5377 ; 0x1501
db 'MITSUBISHI ELECTRIC LOGISTICS SUPPORT CO '
dw 5378 ; 0x1502
db 'KAWASAKI LSI USA INC '
dw 5379 ; 0x1503
db 'KAISER ELECTRONICS '
dw 5380 ; 0x1504
db 'ITA INGENIEURBURO FUR TESTAUFGABEN GMBH '
dw 5381 ; 0x1505
db 'CHAMELEON SYSTEMS INC '
dw 5382 ; 0x1506
db 'HTEC LTD '
dw 5383 ; 0x1507
db 'HONDA CONNECTORS/MHOTRONICS INC '
dw 5384 ; 0x1508
db 'FIRST INTERNATIONAL COMPUTER INC '
dw 5385 ; 0x1509
db 'FORVUS RESEARCH INC '
dw 5386 ; 0x150A
db 'YAMASHITA SYSTEMS CORP '
dw 5387 ; 0x150B
db 'KYOPAL CO LTD '
dw 5388 ; 0x150C
db 'WARPSPPED INC '
dw 5389 ; 0x150D
db 'C-PORT CORPORATION '
dw 5390 ; 0x150E
db 'INTEC GMBH '
dw 5391 ; 0x150F
db 'BEHAVIOR TECH COMPUTER CORP '
dw 5392 ; 0x1510
db 'CENTILLIUM TECHNOLOGY CORP '
dw 5393 ; 0x1511
db 'ROSUN TECHNOLOGIES INC '
dw 5394 ; 0x1512
db 'RAYCHEM '
dw 5395 ; 0x1513
db 'TFL LAN INC '
dw 5396 ; 0x1514
db 'ICS ADVENT '
dw 5397 ; 0x1515
db 'MYSON TECHNOLOGY INC '
dw 5398 ; 0x1516
db 'ECHOTEK CORPORATION '
dw 5399 ; 0x1517
db 'PEP MODULAR COMPUTERS GMBH '
dw 5400 ; 0x1518
db 'TELEFON AKTIEBOLAGET LM Ericsson '
dw 5401 ; 0x1519
db 'GLOBETEK INC '
dw 5402 ; 0x151A
db 'COMBOX LTD '
dw 5403 ; 0x151B
db 'DIGITAL AUDIO LABS INC '
dw 5404 ; 0x151C
db 'FUJITSU COMPUTER PRODUCTS OF AMERICA '
dw 5405 ; 0x151D
db 'MATRIX CORP. '
dw 5406 ; 0x151E
db 'TOPIC SEMICONDUCTOR CORP '
dw 5407 ; 0x151F
db 'CHAPLET SYSTEM INC '
dw 5408 ; 0x1520
db 'BELL CORPORATION '
dw 5409 ; 0x1521
db 'MAINPINE LIMITED '
dw 5410 ; 0x1522
db 'MUSIC SEMICONDUCTORS '
dw 5411 ; 0x1523
db 'ENE TECHNOLOGY INC '
dw 5412 ; 0x1524
db 'IMPACT TECHNOLOGIES '
dw 5413 ; 0x1525
db 'ISS '
dw 5414 ; 0x1526
db 'SOLECTRON '
dw 5415 ; 0x1527
db 'ACKSYS '
dw 5416 ; 0x1528
db 'AMERICAN MICROSYSTEMS INC '
dw 5417 ; 0x1529
db 'QUICKTURN DESIGN SYSTEMS '
dw 5418 ; 0x152A
db 'FLYTECH TECHNOLOGY CO LTD '
dw 5419 ; 0x152B
db 'MACRAIGOR SYSTEMS LLC '
dw 5420 ; 0x152C
db 'QUANTA COMPUTER INC '
dw 5421 ; 0x152D
db 'MELEC INC '
dw 5422 ; 0x152E
db 'PHILIPS-CRYPTO '
dw 5423 ; 0x152F
db 'ACQIS TECHNOLOGY '
dw 5424 ; 0x1530
db 'CHRYON CORP. '
dw 5425 ; 0x1531
db 'ECHELON CORPORATION '
dw 5426 ; 0x1532
db 'BALTIMORE '
dw 5427 ; 0x1533
db 'ROAD CORPORATION '
dw 5428 ; 0x1534
db 'EVERGREEN TECHNOLOGIES INC '
dw 5429 ; 0x1535
db 'DATALEX COMMUNCATIONS '
dw 5431 ; 0x1537
db 'ARALION INC. '
dw 5432 ; 0x1538
db 'ATELIER INFORMATIQUES et ELECTRONIQUE ETUDES S.A. '
dw 5433 ; 0x1539
db 'ONO SOKKI '
dw 5434 ; 0x153A
db 'TERRATEC ELECTRONIC GMBH '
dw 5435 ; 0x153B
db 'ANTAL ELECTRONIC '
dw 5436 ; 0x153C
db 'FILANET CORPORATION '
dw 5437 ; 0x153D
db 'TECHWELL INC '
dw 5438 ; 0x153E
db 'MIPS DENMARK '
dw 5439 ; 0x153F
db 'PROVIDEO MULTIMEDIA CO LTD '
dw 5440 ; 0x1540
db 'TELOSITY INC. '
dw 5441 ; 0x1541
db 'VIVID TECHNOLOGY INC '
dw 5442 ; 0x1542
db 'SILICON LABORATORIES '
dw 5443 ; 0x1543
db 'DCM DATA SYSTEMS '
dw 5444 ; 0x1544
db 'VISIONTEK '
dw 5445 ; 0x1545
db 'IOI TECHNOLOGY CORP. '
dw 5446 ; 0x1546
db 'MITUTOYO CORPORATION '
dw 5447 ; 0x1547
db 'JET PROPULSION LABORATORY '
dw 5448 ; 0x1548
db 'INTERCONNECT SYSTEMS SOLUTIONS '
dw 5449 ; 0x1549
db 'MAX TECHNOLOGIES INC. '
dw 5450 ; 0x154A
db 'COMPUTEX CO LTD '
dw 5451 ; 0x154B
db 'VISUAL TECHNOLOGY INC. '
dw 5452 ; 0x154C
db 'PAN INTERNATIONAL INDUSTRIAL CORP '
dw 5453 ; 0x154D
db 'SERVOTEST LTD '
dw 5454 ; 0x154E
db 'STRATABEAM TECHNOLOGY '
dw 5455 ; 0x154F
db 'OPEN NETWORK CO LTD '
dw 5456 ; 0x1550
db 'SMART ELECTRONIC DEVELOPMENT GMBH '
dw 5457 ; 0x1551
db 'RACAL AIRTECH LTD '
dw 5458 ; 0x1552
db 'CHICONY ELECTRONICS CO LTD '
dw 5459 ; 0x1553
db 'PROLINK MICROSYSTEMS CORP. '
dw 5460 ; 0x1554
db 'GESYTEC GMBH '
dw 5461 ; 0x1555
db 'PLD APPLICATIONS '
dw 5462 ; 0x1556
db 'MEDIASTAR CO. LTD '
dw 5463 ; 0x1557
db 'CLEVO/KAPOK COMPUTER '
dw 5464 ; 0x1558
db 'SI LOGIC LTD '
dw 5465 ; 0x1559
db 'INNOMEDIA INC '
dw 5466 ; 0x155A
db 'PROTAC INTERNATIONAL CORP '
dw 5467 ; 0x155B
db 'CEMAX-ICON INC '
dw 5468 ; 0x155C
db 'MAC SYSTEM CO LTD '
dw 5469 ; 0x155D
db 'LP ELEKTRONIK GMBH '
dw 5470 ; 0x155E
db 'PERLE SYSTEMS LIMITED '
dw 5471 ; 0x155F
db 'TERAYON COMMUNICATIONS SYSTEMS '
dw 5472 ; 0x1560
db 'VIEWGRAPHICS INC '
dw 5473 ; 0x1561
db 'SYMBOL TECHNOLOGIES '
dw 5474 ; 0x1562
db 'A-TREND '
dw 5475 ; 0x1563
db 'YAMAKATSU ELECTRONICS INDUSTRY CO LTD '
dw 5476 ; 0x1564
db 'BIOSTAR MICROTECH INT CORP '
dw 5477 ; 0x1565
db 'ARDENT TECHNOLOGIES INC '
dw 5478 ; 0x1566
db 'JUNGSOFT '
dw 5479 ; 0x1567
db 'DDK ELECTRONICS INC '
dw 5480 ; 0x1568
db 'PALIT MICROSYSTEMS INC '
dw 5481 ; 0x1569
db 'AVTEC SYSTEMS '
dw 5482 ; 0x156A
db '2WIRE '
dw 5483 ; 0x156B
db 'VIDAC ELECTRONICS GMBH '
dw 5484 ; 0x156C
db 'ALPHA-TOP CORP '
dw 5485 ; 0x156D
db 'ALFA INC '
dw 5486 ; 0x156E
db 'M-SYSTEMS FLASH DISK PIONEERS LTD '
dw 5487 ; 0x156F
db 'LECROY CORPORATION '
dw 5488 ; 0x1570
db 'CONTEMPORARY CONTROLS '
dw 5489 ; 0x1571
db 'OTIS ELEVATOR COMPANY '
dw 5490 ; 0x1572
db 'LATTICE-VANTIS '
dw 5491 ; 0x1573
db 'FAIRCHILD SEMICONDUCTOR '
dw 5492 ; 0x1574
db 'VOLTAIRE ADVANCED DATA SECURITY LTD '
dw 5493 ; 0x1575
db 'VIEWCAST COM '
dw 5494 ; 0x1576
db 'HITT '
dw 5496 ; 0x1578
db 'DUAL TECHNOLOGY CORPORATION '
dw 5497 ; 0x1579
db 'JAPAN ELECRONICS IND. INC '
dw 5498 ; 0x157A
db 'STAR MULTIMEDIA CORP. '
dw 5499 ; 0x157B
db 'EUROSOFT (UK) LTD '
dw 5500 ; 0x157C
db 'GEMFLEX NETWORKS '
dw 5501 ; 0x157D
db 'TRANSITION NETWORKS '
dw 5502 ; 0x157E
db 'PX INSTRUMENTS TECHNOLOGY LTD '
dw 5503 ; 0x157F
db 'PRIMEX AEROSPACE CO. '
dw 5504 ; 0x1580
db 'SEH COMPUTERTECHNIK GMBH '
dw 5505 ; 0x1581
db 'CYTEC CORPORATION '
dw 5506 ; 0x1582
db 'INET TECHNOLOGIES INC '
dw 5507 ; 0x1583
db 'UNIWILL COMPUTER CORP '
dw 5508 ; 0x1584
db 'LOGITRON '
dw 5509 ; 0x1585
db 'LANCAST INC '
dw 5510 ; 0x1586
db 'KONICA CORPORATION '
dw 5511 ; 0x1587
db 'SOLIDUM SYSTEMS CORP '
dw 5512 ; 0x1588
db 'ATLANTEK MICROSYSTEMS PTY LTD '
dw 5513 ; 0x1589
db 'DIGALOG SYSTEMS INC '
dw 5514 ; 0x158A
db 'ALLIED DATA TECHNOLOGIES '
dw 5515 ; 0x158B
db 'HITACHI SEMICONDUCTOR & DEVICES SALES CO LTD '
dw 5516 ; 0x158C
db 'POINT MULTIMEDIA SYSTEMS '
dw 5517 ; 0x158D
db 'LARA TECHNOLOGY INC '
dw 5518 ; 0x158E
db 'DITECT COOP '
dw 5519 ; 0x158F
db '3PARDATA '
dw 5520 ; 0x1590
db 'ARN '
dw 5521 ; 0x1591
db 'SYBA TECH LIMITED '
dw 5522 ; 0x1592
db 'BOPS INC '
dw 5523 ; 0x1593
db 'NETGAME LTD '
dw 5524 ; 0x1594
db 'DIVA SYSTEMS CORP. '
dw 5525 ; 0x1595
db 'FOLSOM RESEARCH INC '
dw 5526 ; 0x1596
db 'MEMEC DESIGN SERVICES '
dw 5527 ; 0x1597
db 'GRANITE MICROSYSTEMS '
dw 5528 ; 0x1598
db 'DELTA ELECTRONICS INC '
dw 5529 ; 0x1599
db 'GENERAL INSTRUMENT '
dw 5530 ; 0x159A
db 'FARADAY TECHNOLOGY CORP '
dw 5531 ; 0x159B
db 'STRATUS COMPUTER SYSTEMS '
dw 5532 ; 0x159C
db 'NINGBO HARRISON ELECTRONICS CO LTD '
dw 5533 ; 0x159D
db 'A-MAX TECHNOLOGY '
dw 5534 ; 0x159E
db 'GALEA NETWORK SECURITY '
dw 5535 ; 0x159F
db 'COMPUMASTER SRL '
dw 5536 ; 0x15A0
db 'GEOCAST NETWORK SYSTEMS INC '
dw 5537 ; 0x15A1
db 'CATALYST ENTERPRISES INC '
dw 5538 ; 0x15A2
db 'ITALTEL '
dw 5539 ; 0x15A3
db 'X-NET OY '
dw 5540 ; 0x15A4
db 'TOYOTA MACS INC '
dw 5541 ; 0x15A5
db 'SUNLIGHT ULTRASOUND TECHNOLOGIES LTD '
dw 5542 ; 0x15A6
db 'SSE TELECOM INC '
dw 5543 ; 0x15A7
db 'SHANGHAI COMMUNICATIONS TECHNOLOGIES CENTER '
dw 5544 ; 0x15A8
db 'MORETON BAY '
dw 5546 ; 0x15AA
db 'BLUESTEEL NETWORKS INC '
dw 5547 ; 0x15AB
db 'NORTH ATLANTIC INSTRUMENTS '
dw 5548 ; 0x15AC
db 'VMWARE '
dw 5549 ; 0x15AD
db 'AMERSHAM PHARMACIA BIOTECH '
dw 5550 ; 0x15AE
db 'ZOLTRIX INTERNATIONAL LIMITED '
dw 5552 ; 0x15B0
db 'SOURCE TECHNOLOGY INC '
dw 5553 ; 0x15B1
db 'MOSAID TECHNOLOGIES INC. '
dw 5554 ; 0x15B2
db 'MELLANOX TECHNOLOGY '
dw 5555 ; 0x15B3
db 'CCI/TRIAD '
dw 5556 ; 0x15B4
db 'CIMETRICS INC '
dw 5557 ; 0x15B5
db 'TEXAS MEMORY SYSTEMS INC '
dw 5558 ; 0x15B6
db 'SANDISK CORP. '
dw 5559 ; 0x15B7
db 'ADDI-DATA GMBH '
dw 5560 ; 0x15B8
db 'MAESTRO DIGITAL COMMUNICATIONS '
dw 5561 ; 0x15B9
db 'IMPACCT TECHNOLOGY CORP '
dw 5562 ; 0x15BA
db 'PORTWELL INC '
dw 5563 ; 0x15BB
db 'AGILENT TECHNOLOGIES '
dw 5564 ; 0x15BC
db 'DFI INC. '
dw 5565 ; 0x15BD
db 'SOLA ELECTRONICS '
dw 5566 ; 0x15BE
db 'HIGH TECH COMPUTER CORP (HTC) '
dw 5567 ; 0x15BF
db 'BVM LIMITED '
dw 5568 ; 0x15C0
db 'QUANTEL '
dw 5569 ; 0x15C1
db 'NEWER TECHNOLOGY INC '
dw 5570 ; 0x15C2
db 'TAIWAN MYCOMP CO LTD '
dw 5571 ; 0x15C3
db 'EVSX '
dw 5572 ; 0x15C4
db 'PROCOMP INFORMATICS LTD '
dw 5573 ; 0x15C5
db 'TECHNICAL UNIVERSITY OF BUDAPEST '
dw 5574 ; 0x15C6
db 'TATEYAMA SYSTEM LABORATORY CO LTD '
dw 5575 ; 0x15C7
db 'PENTA MEDIA CO. LTD '
dw 5576 ; 0x15C8
db 'SEROME TECHNOLOGY INC '
dw 5577 ; 0x15C9
db 'BITBOYS OY '
dw 5578 ; 0x15CA
db 'AG ELECTRONICS LTD '
dw 5579 ; 0x15CB
_FOURTHPART: ;lists 100 vendors
db 'HOTRAIL INC. '
dw 5580 ; 0x15CC
db 'DREAMTECH CO LTD '
dw 5581 ; 0x15CD
db 'GENRAD INC. '
dw 5582 ; 0x15CE
db 'HILSCHER GMBH '
dw 5583 ; 0x15CF
db 'INFINEON TECHNOLOGIES AG '
dw 5585 ; 0x15D1
db 'FIC (FIRST INTERNATIONAL COMPUTER INC) '
dw 5586 ; 0x15D2
db 'NDS TECHNOLOGIES ISRAEL LTD '
dw 5587 ; 0x15D3
db 'IWILL CORPORATION '
dw 5588 ; 0x15D4
db 'TATUNG CO. '
dw 5589 ; 0x15D5
db 'ENTRIDIA CORPORATION '
dw 5590 ; 0x15D6
db 'ROCKWELL-COLLINS '
dw 5591 ; 0x15D7
db 'CYBERNETICS TECHNOLOGY CO LTD '
dw 5592 ; 0x15D8
db 'SUPER MICRO COMPUTER INC '
dw 5593 ; 0x15D9
db 'CYBERFIRM INC. '
dw 5594 ; 0x15DA
db 'APPLIED COMPUTING SYSTEMS INC. '
dw 5595 ; 0x15DB
db 'LITRONIC INC '
dw 5596 ; 0x15DC
db 'SIGMATEL INC. '
dw 5597 ; 0x15DD
db 'MALLEABLE TECHNOLOGIES INC '
dw 5598 ; 0x15DE
db 'INFINILINK CORP. '
dw 5599 ; 0x15DF
db 'CACHEFLOW INC '
dw 5600 ; 0x15E0
db 'VOICE TECHNOLOGIES GROUP INC '
dw 5601 ; 0x15E1
db 'QUICKNET TECHNOLOGIES INC '
dw 5602 ; 0x15E2
db 'NETWORTH TECHNOLOGIES INC '
dw 5603 ; 0x15E3
db 'VSN SYSTEMEN BV '
dw 5604 ; 0x15E4
db 'VALLEY TECHNOLOGIES INC '
dw 5605 ; 0x15E5
db 'AGERE INC. '
dw 5606 ; 0x15E6
db 'GET ENGINEERING CORP. '
dw 5607 ; 0x15E7
db 'NATIONAL DATACOMM CORP. '
dw 5608 ; 0x15E8
db 'PACIFIC DIGITAL CORP. '
dw 5609 ; 0x15E9
db 'TOKYO DENSHI SEKEI K.K. '
dw 5610 ; 0x15EA
db 'DRSEARCH GMBH '
dw 5611 ; 0x15EB
db 'BECKHOFF GMBH '
dw 5612 ; 0x15EC
db 'MACROLINK INC '
dw 5613 ; 0x15ED
db 'IN WIN DEVELOPMENT INC. '
dw 5614 ; 0x15EE
db 'INTELLIGENT PARADIGM INC '
dw 5615 ; 0x15EF
db 'B-TREE SYSTEMS INC '
dw 5616 ; 0x15F0
db 'TIMES N SYSTEMS INC '
dw 5617 ; 0x15F1
db 'DIAGNOSTIC INSTRUMENTS INC '
dw 5618 ; 0x15F2
db 'DIGITMEDIA CORP. '
dw 5619 ; 0x15F3
db 'VALUESOFT '
dw 5620 ; 0x15F4
db 'POWER MICRO RESEARCH '
dw 5621 ; 0x15F5
db 'EXTREME PACKET DEVICE INC '
dw 5622 ; 0x15F6
db 'BANCTEC '
dw 5623 ; 0x15F7
db 'KOGA ELECTRONICS CO '
dw 5624 ; 0x15F8
db 'ZENITH ELECTRONICS CORPORATION '
dw 5625 ; 0x15F9
db 'J P AXZAM CORPORATION '
dw 5626 ; 0x15FA
db 'ZILOG INC. '
dw 5627 ; 0x15FB
db 'TECHSAN ELECTRONICS CO LTD '
dw 5628 ; 0x15FC
db 'N-CUBED.NET '
dw 5629 ; 0x15FD
db 'KINPO ELECTRONICS INC '
dw 5630 ; 0x15FE
db 'FASTPOINT TECHNOLOGIES INC. '
dw 5631 ; 0x15FF
db 'NORTHROP GRUMMAN-CANADA LTD '
dw 5632 ; 0x1600
db 'TENTA TECHNOLOGY '
dw 5633 ; 0x1601
db 'PROSYS-TEC INC. '
dw 5634 ; 0x1602
db 'NOKIA WIRELESS BUSINESS COMMUNICATIONS '
dw 5635 ; 0x1603
db 'CENTRAL SYSTEM RESEARCH CO LTD '
dw 5636 ; 0x1604
db 'PAIRGAIN TECHNOLOGIES '
dw 5637 ; 0x1605
db 'EUROPOP AG '
dw 5638 ; 0x1606
db 'LAVA SEMICONDUCTOR MANUFACTURING INC. '
dw 5639 ; 0x1607
db 'AUTOMATED WAGERING INTERNATIONAL '
dw 5640 ; 0x1608
db 'SCIEMETRIC INSTRUMENTS INC '
dw 5641 ; 0x1609
db 'AMBIENT TECHNOLOGIES INC '
dw 6163 ; 0x1813
db 'Jaton Corp '
dw 6931 ; 0x1B13
db 'TEMPORAL RESEARCH LTD '
dw 8193 ; 0x2001
db 'CHAINTECH COMPUTER CO. LTD '
dw 9999 ; 0x270F
db 'HINT CORP '
dw 13192 ; 0x3388
db 'QUANTUM DESIGNS (H.K.) INC. '
dw 13329 ; 0x3411
db 'AVANCE LOGIC INC '
dw 16389 ; 0x4005
db 'DELTA NETWORKS INC '
dw 16435 ; 0x4033
db 'ALADDIN KNOWLEDGE SYSTEMS '
dw 16748 ; 0x416C
db 'CONEXANT (WAS ICOMPRESION INC.) '
dw 17476 ; 0x4444
db 'GROWTH NETWORKS '
dw 18755 ; 0x4943
db 'SEANIX TECHNOLOGY INC '
dw 19617 ; 0x4CA1
db 'MEDIAQ INC. '
dw 19793 ; 0x4D51
db 'MICROTECHNICA CO LTD '
dw 19796 ; 0x4D54
db 'S S TECHNOLOGIES '
dw 20790 ; 0x5136
db 'S3 INC. '
dw 21299 ; 0x5333
db 'TERALOGIC INC '
dw 21580 ; 0x544C
db 'GENROCO INC '
dw 21845 ; 0x5555
db 'LOGITEC CORP. '
dw 25609 ; 0x6409
db 'DECISION COMPUTER INTERNATIONAL CO. '
dw 26214 ; 0x6666
db 'INTEL CORP. '
dw 32902 ; 0x8086
db 'SILICON MAGIC CORP. '
dw 34952 ; 0x8888
db 'COMPUTONE CORPORATION '
dw 36366 ; 0x8E0E
db 'ADAPTEC '
dw 36868 ; 0x9004
db 'GIGAPIXEL CORP '
dw 37274 ; 0x919A
db 'OMNI MEDIA TECHNOLOGY INC. '
dw 38553 ; 0x9699
db 'AOPEN INC. '
dw 41120 ; 0xA0A0
db 'HEWLETT PACKARD '
dw 41561 ; 0xA259
db 'DIGITAL RECEIVER TECHNOLOGY INC '
dw 44062 ; 0xAC1E
db 'MOTOROLA '
dw 49374 ; 0xC0DE
db 'MOTION ENGINEERING. '
dw 49406 ; 0xC0FE
db 'VARIAN AUSTRIALIA PTY LTD '
dw 51792 ; 0xCA50
db 'CHRYSALIS-ITS '
dw 51966 ; 0xCAFE
db 'CATAPULT COMMUNICATIONS '
dw 52428 ; 0xCCCC
db 'DY4 Systems Inc '
dw 54484 ; 0xD4D4
db 'EKF ELEKTRONIK GMBH '
dw 58559 ; 0xE4BF
db 'EAGLE TECHNOLOGY '
dw 59905 ; 0xEA01
db 'FAST SEARCH & TRANSFER ASA '
dw 64087 ; 0xFA57
db 'EPIGRAM INC '
dw 65242 ; 0xFEDA
;----------------------------------------------------------------------
_UNKNOWN: db 'UNKOWN VENDOR '
 
 
PREVIOUSVERSIONLIST:
db 'LUCENT '
dw 4545 ; 0x11C1
db 'EPOX '
dw 5781 ; 0x1695
db 'AVERMEDIA '
dw 5217 ; 0x1461
db 'NVIDIA (WAS: STB,SGS THOMPSON) '
dw 4818 ; 0x12D2
db 'ALBATRON '
dw 6130 ; 0x17F2
db 'ASROCK '
dw 6217 ; 0x1849
db 'CONEXANT, ROCKWELL '
dw 4730 ; 0x127A
 
_UNKNOWND:
db 'UNKOWN DEVICE '
 
Class0:
db 'Prehistoric - misc '
dw 00 ; 0x00
db 'Prehistoric - VGA '
dw 01 ; 0x01
 
Class1:
db 'Storage - SCSI '
dw 00 ; 0x00
db 'Storage - IDE '
dw 01 ; 0x01
db 'Storage - Floppy '
dw 02 ; 0x02
db 'Storage - IPI '
dw 03 ; 0x03
db 'Storage - RAID '
dw 04 ; 0x04
db 'Storage - ATA with DMA '
dw 05 ; 0x05
db 'Storage - Serial ATA '
dw 06 ; 0x06
db 'Storage - misc '
dw 128 ; 0x80
 
 
Class2:
db 'Network - Ethernet '
dw 00 ; 0x0
db 'Network - Token Ring '
dw 01 ; 0x1
db 'Network - FDDI '
dw 02 ; 0x2
db 'Network - ATM '
dw 03 ; 0x3
db 'Network - ISDN '
dw 04 ; 0x4
db 'Network - WorldFip '
dw 05 ; 0x5
db 'Network - PICMG 2.14 '
dw 06 ; 0x6
db 'Network - misc '
dw 128 ; 0x80
Class3:
db 'Display - VGA controller '
dw 00 ; 0x0
db 'Display - XGA controller '
dw 01 ; 0x1
db 'Display - 3D controller '
dw 02 ; 0x2
db 'Display - misc '
dw 128 ; 0x80
 
Class4:
db 'Multimedia - Video '
dw 00 ; 0x0
db 'Multimedia - Audio '
dw 01 ; 0x1
db 'Multimedia - Computer telephony '
dw 02 ; 0x2
db 'Multimedia - misc '
dw 128 ; 0x80
Class5:
db 'Memory - RAM '
dw 00 ; 0x0
db 'Memory- Flash memory '
dw 01 ; 0x1
db 'Memory - misc '
dw 128 ; 0x80
 
Class6:
db 'Bridge - CPU/PCI '
dw 00 ; 0x00
db 'Bridge - PCI/ISA '
dw 01 ; 0x01
db 'Bridge - PCI/EISA '
dw 02 ; 0x02
db 'Bridge - PCI/MCA '
dw 03 ; 0x03
db 'Bridge - PCI/PCI '
dw 04 ; 0x04
db 'Bridge - PCMCIA '
dw 05 ; 0x05
db 'Bridge - NuBus '
dw 06 ; 0x06
db 'Bridge - CardBus '
dw 07 ; 0x07
db 'Bridge - RACEway '
dw 08 ; 0x08
db 'Bridge - Semi-transpar. PCI/PCI '
dw 09 ; 0x09
db 'Bridge - InfiniBand/PCI '
dw 10 ; 0x0A
db 'Bridge - misc '
dw 128 ; 0x80
Class7:
db 'Communication - Serial '
dw 00 ; 0x0
db 'Communication - Parallel '
dw 01 ; 0x1
db 'Communication - Multiport Serial'
dw 02 ; 0x2
db 'Communication - Modem '
dw 03 ; 0x3
db 'Communication - GPIB '
dw 04 ; 0x4
db 'Communication - Smart Card '
dw 05 ; 0x5
db 'Communication - misc '
dw 128 ; 0x80
Class8:
db 'System - PIC '
dw 00 ; 0x0
db 'System - DMAC '
dw 01 ; 0x1
db 'System - Timer '
dw 02 ; 0x2
db 'System - RTC '
dw 03 ; 0x3
db 'System - PCI Hot-Plug '
dw 04 ; 0x4
db 'System - misc '
dw 128 ; 0x80
 
Class9:
db 'Input - Keyboard '
dw 00 ; 0x0
db 'Input - Digitazer (pen) '
dw 01 ; 0x1
db 'Input - Mouse '
dw 02 ; 0x2
db 'Input - Scanner '
dw 03 ; 0x3
db 'Input - Gameport '
dw 04 ; 0x4
db 'Input - misc '
dw 128 ; 0x80
ClassA:
db 'Docking - Generic station '
dw 00 ; 0x0
db 'Docking - misc '
dw 128 ; 0x80
 
 
ClassB:
db 'Processor - 386 '
dw 00 ; 0x0
db 'Processor - 486 '
dw 01 ; 0x1
db 'Processor - Pentium '
dw 02 ; 0x2
db 'Processor - Alpha '
dw 16 ; 0x10
db 'Processor - PowerPC '
dw 32 ; 0x20
db 'Processor - MIPS '
dw 48 ; 0x30
db 'Processor - Co-processor '
dw 64 ; 0x40
ClassC:
db 'Serial Bus - FireWire '
dw 00 ; 0x0
db 'Serial Bus - ACCESS.bus '
dw 01 ; 0x1
db 'Serial Bus - SSA '
dw 02 ; 0x2
db 'Serial Bus - USB/USB2 '
dw 03 ; 0x3
db 'Serial Bus - Fibre Channel '
dw 04 ; 0x4
db 'Serial Bus - SMBus '
dw 05 ; 0x5
db 'Serial Bus - InfiniBand '
dw 06 ; 0x6
db 'Serial Bus - IPMI '
dw 07 ; 0x7
db 'Serial Bus - SERCOS '
dw 08 ; 0x8
db 'Serial Bus - CANbus '
dw 09 ; 0x9
 
ClassD:
db 'Wireless - iRDA '
dw 00 ; 0x0
db 'Wireless - Consumer IR '
dw 01 ; 0x1
db 'Wireless - RF '
dw 16 ; 0x10
db 'Wireless - Bluetooth '
dw 17 ; 0x11
db 'Wireless - Broadband '
dw 18 ; 0x12
db 'Wireless - Ethernet (802.11a) '
dw 32 ; 0x20
db 'Wireless - Ethernet (802.11b) '
dw 33 ; 0x21
db 'Wireless - misc '
dw 128 ; 0x80
 
ClassE:
db 'Intelligent I/O - I/O contr. '
dw 00 ; 0x0
 
ClassF:
db 'Satellite Communication - TV '
dw 01 ; 0x1
db 'Satellite Communication - Audio '
dw 02 ; 0x2
db 'Satellite Communication - Voice '
dw 03 ; 0x3
db 'Satellite Communication - Data '
dw 04 ; 0x4
 
Class10:
db 'En/Decryption - Network&comput. '
dw 00 ; 0x0
db 'En/Decryption - Entertainment '
dw 16 ; 0x10
db 'En/Decryption - misc '
dw 128 ; 0x80
 
Class11:
db 'DSP - DPIO modules '
dw 00 ; 0x0
db 'DSP - Performance counters '
dw 01 ; 0x1
db 'DSP - Sync./Test/Measurement '
dw 16 ; 0x10
db 'DSP - Managamant card '
dw 32 ; 0x20
db 'DSP - misc '
dw 128 ; 0x80
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/phenix/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 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 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:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/phenix/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:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/phenix/trunk/ascl.inc
0,0 → 1,895
;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 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
words2reg 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
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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/phenix/trunk/ascml.inc
0,0 → 1,94
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Massive operation
; Libary
;
; Ver 0.1 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 readmas,compmas,findmas
 
macro readmas masoff,obroff
{
local loo
mov edi,masoff ;tekoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
}
 
 
macro compmas masoff1,masoff2,obroff
{
local loo,loo2
mov esi,masoff2
add esi,8
mov ecx,[masoff2]
mov ebx,[masoff2+4]
mov eax,0
 
loo2:
push eax
 
mov edi,masoff1 ;tekoff
add edi,8
mov ebp,[masoff1] ;elements1
mov edx,[masoff1+4] ;elemsize1
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
 
add esi,ebx
pop eax
inc eax
cmp eax,ecx
jne loo2
}
 
 
macro findmas masoff,obroff
{
local loo,looend,lend
mov edi,masoff ;tekoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
mov eax,0
call obroff
cmp eax,1
je looend
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
stc
jmp lend
looend:
popad
clc
lend:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/phenix/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm phenix.asm phenix
@pause
/programs/phenix/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm phenix.asm phenix
@pause
/programs/phenix/trunk/phenix.asm
0,0 → 1,1328
;
; Phenix Dynamic Game Created by Pavlushin Evgeni for ASCL
;
; 100% Full relase!
;
; www.waptap@mail.ru
;
 
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IM_END ; size of image
dd I_END ; memory for app
dd I_END ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
 
 
include 'lang.inc'
include 'ascl.inc'
include 'ascgl.inc'
include 'ascml.inc'
 
 
showmas:
cmp [edi+8],dword 0
je noshow
cmp [edi+8],dword 1
jne no_gun
mov eax,shoot
jmp outp
no_gun:
push edi
random 3,ebx
pop edi
cmp ebx,0
jne no_star
mov eax,star
jmp outp
no_star:
cmp ebx,1
jne no_star2
mov eax,star2
jmp outp
no_star2:
mov eax,star3
outp:
aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0
noshow:
ret
 
showobjmas:
cmp [edi+8],dword 0
je noshow1
cmp [edi+4],dword 380
jg noshow1
cmp [edi+4],dword 0
jl noshow1
cmp [edi+8],dword 1
jne no_warship1
mov eax,warship1
jmp outws
no_warship1:
cmp [edi+8],dword 2
jne no_warship2
mov eax,warship2
jmp outws
no_warship2:
cmp [edi+8],dword 3
jne no_meteor
mov eax,meteor
jmp outws
no_meteor:
cmp [edi+8],dword 4
jne no_box
mov eax,box
jmp outws
no_box:
outws:
aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0
noshow1:
ret
 
 
moveobjmas:
cmp [edi+8],dword 0
je no_ws
mov eax,[edi+12]
add [edi],eax
mov eax,[edi+16]
add [edi+4],eax
 
cmp dword [edi],600
jng xok1
sub dword [edi],20
neg dword [edi+12]
jmp xok2
xok1:
cmp dword [edi],0
jnl xok2
add dword [edi],20
neg dword [edi+12]
xok2:
cmp dword [edi+4],400
jng yok
mov dword [edi+8],0
ret
yok:
cmp dword [edi+8],2 ;green ship
jne no_grs
cmp dword [edi+4],100
jna no_grs
cmp dword [edi+4],103
jna grs
cmp dword [edi+4],200
jna no_grs
cmp dword [edi+4],203
jna grs
cmp dword [edi+4],300
jna no_grs
cmp dword [edi+4],303
ja no_grs
grs:
neg dword [edi+12]
mov [temp],edi
findmas massive,findzero
;in edi off to free element
jc close_app
mov esi,edi
mov edi,[temp]
mov eax,[edi]
mov [esi],eax
mov eax,[edi+4]
mov [esi+4],eax
mov [esi+8],dword 1
mov [esi+12],dword 0
mov [esi+16],dword 10
no_grs:
 
cmp dword [edi+8],1 ;blue ship
jne no_bls
cmp dword [edi+4],50
jna no_bls
cmp dword [edi+4],64
jna bls
cmp dword [edi+4],100
jna no_bls
cmp dword [edi+4],114
jna bls
cmp dword [edi+4],150
jna no_bls
cmp dword [edi+4],164
ja no_bls
bls:
mov [temp],edi
findmas massive,findzero
jc close_app
mov esi,edi
mov edi,[temp]
mov eax,[edi]
mov [esi],eax
mov eax,[edi+4]
mov [esi+4],eax
mov [esi+8],dword 2
mov [esi+12],dword 0
mov [esi+16],dword 5
no_bls:
 
no_ws:
ret
 
 
delfarshoot:
cmp [edi+4],dword 40
jb del
cmp [edi+4],dword 400
ja del
cmp [edi],dword 40
jb del
cmp [edi],dword 600
ja del
jmp nodel
del:
mov [edi+8],dword 0
nodel:
ret
 
 
movemas:
cmp [edi+8],dword 0
jne no_freeel
ret
no_freeel:
mov eax,[edi+12]
add [edi],eax
mov eax,[edi+16]
add [edi+4],eax
ret
 
 
 
endshowmas:
cmp [edi+8],dword 0
je noshowem
mov eax,star2
aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0
noshowem:
ret
 
 
 
endmovemas:
cmp [edi+8],dword 0
jne no_fr
ret
no_fr:
mov eax,[edi+12]
add [edi],eax
mov eax,[edi+16]
add [edi+4],eax
ret
 
 
findzero:
cmp [edi+8],dword 0
je iz_zero
xor eax,eax
ret
iz_zero:
mov eax,1
ret
 
compobr:
cmp [esi+8],dword 0
je no_crsh
cmp [edi+8],dword 0
je no_crsh
cmp [esi+16],dword 0
jg no_crsh
 
mov eax,[esi]
mov [temp],eax
mov eax,[esi+4]
mov [temp2],eax
mov eax,[edi]
mov [temp3],eax
mov eax,[edi+4]
mov [temp4],eax
 
pushad
collimg imgsize,[temp],[temp2],imgsize,[temp3],[temp4],[otv]
popad
cmp [otv],dword 0
je no_crsh
 
cmp [edi+8],dword 2
jne no_grship
inc [gship]
add [score],30
jmp setzero
no_grship:
cmp [edi+8],dword 1
jne no_blship
inc [bship]
add [score],20
jmp setzero
no_blship:
cmp [edi+8],dword 3
jne no_metr
dec dword [edi+16]
cmp dword [edi+16],0
jne mok
mov dword [edi+16],1
mok:
mov [esi+8],dword 0
ret
no_metr:
 
setzero:
mov [esi+8],dword 0
mov [edi+8],dword 0
no_crsh:
ret
 
shipobjtest:
cmp [edi+8],dword 0
je no_obj
mov eax,[edi]
mov [temp3],eax
mov eax,[edi+4]
mov [temp4],eax
pushad
collimg imgsize,[shipx],[shipy],imgsize,[temp3],[temp4],[otv]
popad
cmp [otv],dword 0
je no_obj
cmp [edi+8],dword 4 ;if box
jne no_fbox
add [energy],5
add [score],50
mov [edi+8],dword 0
inc [boxget]
ret
no_fbox:
sub [energy],16
mov [edi+8],dword 0
no_obj:
ret
 
shipguntest:
cmp [edi+8],dword 0
je no_gobj
cmp [edi+16],dword 0
jl no_gobj
mov eax,[edi]
mov [temp3],eax
mov eax,[edi+4]
mov [temp4],eax
pushad
collimg imgsize,[shipx],[shipy],imgsize,[temp3],[temp4],[otv]
popad
cmp [otv],dword 0
je no_gobj
sub [energy],4
mov [edi+8],dword 0
no_gobj:
ret
 
 
START: ; start of execution
 
massize = 400
elemsize = 20
 
mov [massive],dword massize
mov [massive+4],dword elemsize
 
omassize = 100
oelemsize = 20
 
mov [objmas],dword omassize
mov [objmas+4],dword oelemsize
 
 
mov eax,66
mov ebx,1
mov ecx,1
int 0x40
 
mov eax,26
mov ebx,2
mov ecx,1
mov edx,keymap
int 0x40
 
startgame:
gif_hash_offset = gif_hash_area
giftoimg gif_file_area2,canvas
 
gif_hash_offset = gif_hash_area
giftoimg gif_file_area,img_area
 
getimg img_area,0,0,32,32,ship
getimg img_area,32,0,32,32,shoot
getimg img_area,64,0,32,32,warship1
getimg img_area,96,0,32,32,warship2
getimg img_area,128,0,32,32,meteor
getimg img_area,160,0,32,32,star
getimg img_area,192,0,32,32,star2
getimg img_area,224,0,32,32,star3
getimg img_area,0,32,32,32,box
 
 
 
main_menu:
call draw_logowindow
 
stillm:
wtevent redm,keym,buttonm
jmp stillm
redm:
call draw_logowindow
jmp stillm
keym:
mov eax,2
int 0x40
jmp stillm
buttonm:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
je close_app
cmp ah,2 ; button id=1 ?
je start_game
cmp ah,3 ; button id=1 ?
je help
cmp ah,4 ; button id=1 ?
je close_app
jmp stillm
 
draw_logowindow:
call draw_window
setimg 5,21,canvas
drawlbut 300,300,60,14,'START',2,0x990000,cl_Black
drawlbut 300,320,60,14,'HELP',3,0x990000,cl_Black
drawlbut 300,340,60,14,'EXIT',4,0x990000,cl_Black
ret
 
;***********************
; Draw help menu
;***********************
 
help:
call draw_helpwindow
 
stillh:
wtevent redh,keyh,buttonh
jmp stillh
redh:
call draw_helpwindow
jmp stillh
keyh:
mov eax,2
int 0x40
jmp stillh
buttonh:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
je close_app
cmp ah,2 ; button id=1 ?
je start_game
cmp ah,3 ; button id=1 ?
je help
cmp ah,4 ; button id=1 ?
je close_app
cmp ah,5 ; button id=1 ?
je main_menu
jmp stillh
 
draw_helpwindow:
call draw_window
setimg 5,21,canvas
 
drawfbox 40,50,580,380,cl_Grey
 
mov ebp,4*7
mov ebx,180*65536+90
mov edx,helptext
mov esi,50
mov ecx,cl_White
dec ebp
looht:
mov eax,4
int 0x40
add edx,esi
add ebx,10
dec ebp
jnz looht
 
setimg 90,90,ship
setimg 90,130,shoot
setimg 90,170,star
setimg 90,210,warship1
setimg 90,250,warship2
setimg 90,290,meteor
setimg 90,330,box
 
drawlbut 500,400,80,14,'<<BACK',5,0x990000,cl_Black
 
jmp stillh
 
helptext:
db 'Phenix '
db 'Controls: Num1 move left, Num3 move right '
db ' P-pause (use for screen shooting) '
db ' '
 
db 'Lazer cannon '
db 'Press Num5 for shoot '
db 'Core fast, speed fast, reload slow '
db ' '
 
db 'Plazma cannon '
db 'Press Num2 for Plazma Nuke and Num8 for shoot '
db 'Core slow, speed medium, reload fast '
db ' '
 
db 'Blue warship '
db 'Speed fast '
db 'Attack method: plazma bomb '
db ' '
 
db 'Green warship '
db 'Speed slow '
db 'Attack method: laser shoot '
db ' '
 
db 'Meteor '
db 'Dangeros object! '
db 'SuperSheld '
db ' '
 
db 'Fly Box '
db 'Sheld pack, sheld +5, score +30 '
db 'Get for sheld level up! '
db ' '
 
start_game:
 
; jmp end_gm
 
mov [canvas],dword 640
mov [canvas+4],dword 440
 
call draw_window
 
;Main loop wait for event with 10msec
still:
; scevent red,key,button ;for full speed
 
timeevent 1,no_event,red,key,button
no_event:
setimg 5,21,canvas
 
cmp [pause_on],0
jne still
 
cmp [energy],0
jl game_over
 
cmp [ctime],dword 0
je no_dct
dec dword [ctime]
no_dct:
 
cmp [xtime],dword 0
je no_dxt
dec dword [xtime]
no_dxt:
 
 
;
; Add to level new ships
;
inc dword [pathtime]
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov eax,[ebp]
cmp [pathtime],eax ;500
jne no_nextloc
 
randobjmasx:
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
 
mov ecx,[ebp+8]
mov [shiptype],2
mov [xmoving],9
mov [xaccel],4
mov [ymoving],3
mov [yaccel],2
call add_ships
 
mov ecx,[ebp+12]
mov [shiptype],1
mov [xmoving],3
mov [xaccel],1
mov [ymoving],3
mov [yaccel],6
call add_ships
 
mov ecx,[ebp+16]
mov [shiptype],3
mov [xmoving],5
mov [xaccel],2
mov [ymoving],5
mov [yaccel],2
call add_ships
 
mov ecx,[ebp+20]
mov [shiptype],4
mov [xmoving],4
mov [xaccel],1
mov [ymoving],4
mov [yaccel],1
call add_ships
 
jmp newlocend
 
shiptype dd 0
xmoving dd 0
ymoving dd 0
xaccel dd 0
yaccel dd 0
 
add_ships:
looship:
cmp ecx,0
je no_ships
push ecx
findmas objmas,findzero
;in edi off to free element
jc close_app
mov ebp,[shiptype]
mov dword [edi+8],ebp ;2 ;green ship
; random x
push edi
random 600,eax
pop edi
mov [edi],eax
; random y
push edi
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov esi,[ebp+4] ;get max range
random esi,eax
neg eax
pop edi
mov [edi+4],eax
; x moving
push edi ;planers
random [xmoving],eax
sub eax,[xaccel];4
pop edi
mov [edi+12],eax
; y moving
push edi
random [ymoving],eax ;slow
add eax,[yaccel] ;2
pop edi
mov [edi+16],eax
pop ecx
dec ecx
jnz looship
no_ships:
ret
 
 
levelpart dd 0
levels:
;level1
dd 1,800,0,0,5,8,0,0 ;one at start
dd 500,2000,4,20,30,0,0,0
dd 500,2000,4,20,0,8,0,0
dd 500,2000,10,0,0,4,0,0
dd 500,4000,0,30,0,0,0,0
dd 400,400,0,0,10,0,0,0
dd 400,400,0,0,10,0,0,0
dd 0,0,0,0,0,0,0,0 ;end of level
;level2
dd 1,16000,0,30,0,0,0,0 ;one at start
dd 200,8000,0,20,0,0,0,0
dd 200,2000,0,10,0,8,0,0
dd 200,4000,0,10,0,0,0,0
dd 0,0,0,0,0,0,0,0 ;end of level
;level3
dd 1,4000,0,20,30,8,0,0 ;one at start
dd 400,4000,10,10,20,6,0,0
dd 400,4000,0,20,10,2,0,0
dd 400,4000,10,10,20,0,0,0
dd 0,-1,0,0,0,0,0,0 ;end of game
 
 
newlocend:
mov [pathtime],0
inc [levelpart]
jmp no_nextloc
 
endgame dd 0
objects dd 0
endtest:
cmp dword [edi+8],0
jne no_free
ret
no_free:
mov [endgame],0
inc [objects]
ret
 
 
no_nextloc:
mov [objects],0
mov [endgame],1
readmas objmas,endtest
cmp [endgame],1
jne no_end_lev ;no_nextloc
 
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov eax,[ebp+4]
cmp eax,dword 0
je end_lev ;end of level
cmp eax,dword -1
je end_gm ;end of game
 
no_end_lev:
 
cmp [num5],dword 0
je no_addsh
cmp [ctime],dword 0
jne no_addsh
cmp [lazer],dword 0
je no_addsh
findmas massive,findzero
;in edi off to free element
jc close_app
mov eax,[shipx]
mov [edi],eax
mov eax,[shipy]
mov [edi+4],eax
mov [edi+8],dword 1 ;show
mov [edi+12],dword 0
mov [edi+16],dword -12
mov [ctime],dword 8 ;wait for cannon
dec [lazer]
no_addsh:
 
cmp [num8],dword 0
je no_addplx
cmp [xtime],dword 256-16
jae no_addplx
cmp [plazma],0
je no_addplx
findmas massive,findzero
;in edi off to free element
jc close_app
mov eax,[shipx]
mov [edi],eax
mov eax,[shipy]
mov [edi+4],eax
mov [edi+8],dword 2 ;show
add [xtime],dword 8 ;wait for cannon
cmp [xtime],dword 256
jna okx
mov [xtime],256
okx:
mov [edi+12],dword 0 ;wait for cannon
mov [edi+16],dword -8 ;wait for cannon
dec [plazma]
no_addplx:
 
 
 
cmp [num2],dword 0
je no_addsh2
cmp [xtime],dword 0
jne no_addsh2
cmp [plazma],0
je no_addsh2
mov eax,[shipy]
mov [temp3],eax
mov [temp2],dword 5
loox2:
mov [temp],dword 10
loox:
findmas massive,findzero
;in edi off to free element
jc close_app
random 25,eax
mov ebp,eax
sub eax,12
add eax,[shipx]
mov [edi],eax
shr ebp,3
random ebp,eax
neg eax
add eax,[temp3] ;[shipy]
mov [edi+4],eax
mov [edi+8],dword 2 ;show hstar
random 5,eax
sub eax,2
mov [edi+12],eax ;show hstar
random 7,eax
sub eax,8
mov [edi+16],eax ;show hstar
dec [temp]
jnz loox
sub [temp3],30
dec [temp2]
jnz loox2
mov [xtime],dword 256 ;wait for cannon
sub [plazma],50
no_addsh2:
 
 
cmp [num1],dword 0
je no_left
sub dword [shipx],6
no_left:
 
cmp [num3],dword 0
je no_right
add dword [shipx],6
no_right:
 
;ship correct
cmp [shipx],5
jnl xl_ok
mov [shipx],5
xl_ok:
cmp [shipx],603
jng xr_ok
mov [shipx],603
xr_ok:
 
 
;clear scrbuf
mov edi,canvas+8
cld
mov ecx,640*440*3/4
mov eax,0
rep stosd
 
compmas objmas,massive,compobr
 
readmas objmas,shipobjtest
readmas massive,shipguntest
 
readmas objmas,showobjmas
readmas objmas,moveobjmas
 
readmas massive,showmas
readmas massive,movemas
readmas massive,delfarshoot
; findmas massive,findzero
;in edi off to free element
; jc close_app
 
aimgtoimg ship,[shipx],[shipy],canvas,0x0
 
drawfbox 150,5,64,5,0x000000
mov eax,[xtime]
sub eax,256
neg eax
shr eax,2
drawfbox 150,5,eax,5,0x0000ff
 
drawfbox 150,12,64,5,0x000000
mov eax,[ctime]
sub eax,8
neg eax
shl eax,3
drawfbox 150,12,eax,5,0xffff00
 
drawfbox 220,2,6*5+2 ,9,cl_Grey
outcount [plazma],221,3,cl_Blue,5*65536
drawfbox 220,11,6*5+2 ,9,cl_Grey
outcount [lazer],221,12,0xffff00,5*65536
 
 
drawfbox 280,6,6*5+2 ,9,cl_Grey
outcount [gship],281,7,cl_Green,5*65536
drawfbox 320,6,6*5+2 ,9,cl_Grey
outcount [bship],321,7,cl_Blue,5*65536
drawfbox 360,6,6*5+2 ,9,cl_Grey
outcount [boxget],361,7,0xffaa00,5*65536
 
drawfbox 400,2,6*5+2 ,9,cl_Grey
outcount [objects],401,2,0x00ff00,5*65536
drawfbox 400,11,6*5+2 ,9,cl_Grey
outcount [energy],401,12,0xff0000,5*65536
 
drawfbox 450,11,6*5+2 ,9,cl_Grey
outcount [score],451,12,0xffff00,5*65536
 
 
jmp still
 
red:
call draw_window
jmp still
 
key: ; key
mov eax,2
int 0x40 ; read (eax=2)
 
shr eax,8
and eax,0xff
mov ah,al
 
cmp ah,153
jne no_pause
not [pause_on]
jmp still
no_pause:
 
 
cmp ah,76
jne no_num5d
mov [num5],1
jmp still
no_num5d:
cmp ah,204
jne no_num5u
mov [num5],0
jmp still
no_num5u:
 
cmp ah,80
jne no_num2d
mov [num2],1
jmp still
no_num2d:
cmp ah,208
jne no_num2u
mov [num2],0
jmp still
no_num2u:
 
cmp ah,79 ;key_Space 85 exit
jne no_num1d
mov [num1],1
jmp still
no_num1d:
cmp ah,207 ;key_Space 85 exit
jne no_num1u
mov [num1],0
jmp still
no_num1u:
 
cmp ah,81 ;key_Space 85 exit
jne no_num3d
mov [num3],1
jmp still
no_num3d:
cmp ah,209 ;key_Space 85 exit
jne no_num3u
mov [num3],0
jmp still
no_num3u:
 
cmp ah,72 ;key_Space 85 exit
jne no_num8d
mov [num8],1
jmp still
no_num8d:
cmp ah,200 ;key_Space 85 exit
jne no_num8u
mov [num8],0
jmp still
no_num8u:
 
jmp still ; not testing
 
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
close_app:
mov eax,-1 ; close this program
int 0x40
noclose:
jmp still
 
draw_window:
startwd
window 40,40,(640+9),(440+26),window_Skinned+0x00
label 8,8,'ASCL DYNAMIC GAME',cl_White+font_Big
; setimg 5,22,img_area
endwd
ret
 
;**********************
; Game Over process
;**********************
 
game_over:
; close
call draw_gowindow
stillgo:
wtevent redgo,keygo,buttongo
jmp stillgo
redgo:
call draw_gowindow
jmp stillgo
keygo:
mov eax,2
int 0x40
jmp stillgo
buttongo:
mov eax,17 ; get id
int 0x40
cmp ah,1
je close_app
cmp ah,4
je close_app
cmp ah,5
je main_menu
cmp ah,7
je restart_lev
jmp stillgo
 
restart_lev:
mov [pathtime],0
 
prevpart:
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov eax,[ebp]
cmp eax,dword 1
je rest ;end of level
dec [levelpart]
jmp prevpart
 
 
rest:
;massives reset - clear massives
mov edi,massive+8
cld
mov ecx,massize*elemsize/4
mov eax,0
rep stosd
 
mov edi,objmas+8
cld
mov ecx,omassize*oelemsize/4
mov eax,0
rep stosd
 
;counters reset
mov [boxget],0
mov [gship],0
mov [bship],0
 
;ship reset
mov [energy],100
mov [shipx],300
mov [shipy],400
mov [lazer],1000
mov [plazma],500
 
 
; reset keyboard
mov [num1],0
mov [num5],0
mov [num3],0
mov [num2],0
mov [num8],0
jmp start_game
 
draw_gowindow:
startwd
drawfbox 170,160,300,120,cl_Grey
drawlbut 180,260,80,14,'(X) EXIT',4,0x990000,cl_Black
drawlbut 280,260,80,14,'<MENU>',5,0x990000,cl_Black
drawlbut 380,260,80,14,'RESTART',7,0x990000,cl_Black
 
label 280,200,' GAME OVER ',cl_Black
endwd
ret
 
 
;**********************
; End level process
;**********************
 
end_lev:
; close
call draw_scorewindow
stilleg:
wtevent redeg,keyeg,buttoneg
jmp stilleg
redeg:
call draw_scorewindow
jmp stilleg
keyeg:
mov eax,2
int 0x40
jmp stilleg
buttoneg:
mov eax,17 ; get id
int 0x40
cmp ah,1
je close_app
cmp ah,2
je next_lev
cmp ah,3
je help
cmp ah,4
je close_app
cmp ah,5
je main_menu
jmp stilleg
 
next_lev:
mov [pathtime],0
inc [levelpart]
 
;ship reset
mov [energy],100
mov [shipx],300
mov [shipy],400
mov [lazer],1000
mov [plazma],500
 
;counters reset
mov [boxget],0
mov [gship],0
mov [bship],0
 
; reset keyboard
mov [num1],0
mov [num5],0
mov [num3],0
mov [num2],0
mov [num8],0
jmp start_game
 
draw_scorewindow:
call draw_window
startwd
drawfbox 170,130,300,190,cl_Grey
drawlbut 180,300,80,14,'(X) EXIT',4,0x990000,cl_Black
drawlbut 280,300,80,14,'<MENU>',5,0x990000,cl_Black
drawlbut 380,300,80,14,'NEXT >>',2,0x990000,cl_Black
 
setimg 180,140,warship1
outcount [bship],241,151,cl_Blue,5*65536
 
setimg 180,180,warship2
outcount [gship],241,191,cl_Green,5*65536
 
setimg 180,220,meteor
setimg 180,260,box
outcount [boxget],241,271,0xbbbb00,5*65536
endwd
ret
 
 
;**********************
; End of game process
;**********************
 
end_gm:
mov [pathtime],0
call draw_window
label 200 ,8,'YOU WIN PRESS ANY KEY TO EXIT',cl_White+font_Big
 
stilleg2:
; scevent redeg2,keyeg2,buttoneg2
timeevent 1,no_event2,redeg2,keyeg2,buttoneg2
 
no_event2:
setimg 5,21,canvas
 
;clear scrbuf
mov edi,canvas+8
cld
mov ecx,640*440*3/4
mov eax,0
rep stosd
 
aimgtoimg ship,320,220,canvas,0x0
 
readmas massive,endshowmas
readmas massive,endmovemas
readmas massive,delfarshoot
; findmas massive,findzero
;in edi off to free element
; jc close_app
 
inc [pathtime]
cmp [pathtime],30
jne no_firework
mov [pathtime],0
random 400,eax
mov [temp3],eax
random 600,eax
mov [temp2],eax
mov [temp],dword 8;10
xloox:
findmas massive,findzero
;in edi off to free element
jc close_app
 
mov eax,[temp2] ;[shipx]
mov [edi],eax
mov eax,[temp3] ;[shipy]
mov [edi+4],eax
mov [edi+8],dword 2 ;show hstar
rerand:
random 5,eax
sub eax,2
cmp eax,0
je rerand
mov [edi+12],eax ;show hstar
rerand2:
random 7,eax
sub eax,3
cmp eax,0
je rerand2
mov [edi+16],eax ;show hstar
dec [temp]
jnz xloox
no_firework:
jmp stilleg2
 
redeg2:
jmp end_gm ;stilleg2
keyeg2:
mov eax,2
int 0x40
jmp main_menu
buttoneg2:
mov eax,17 ; get id
int 0x40
jmp stilleg2
 
 
 
 
 
 
; DATA AREA
IM_END:
;global
pause_on dd 0
 
;massive
shipx dd 300
shipy dd 400
 
;guns
lazer dd 1000
plazma dd 500
 
;keys
num1 dd 0
num5 dd 0
num3 dd 0
num2 dd 0
num8 dd 0
 
;enemy countres
gship dd 0
bship dd 0
boxget dd 0
 
energy dd 100
score dd 0
 
;delay for cannon
ctime dd 0
;delay for nuke gun
xtime dd 0
;path time
pathtime dd 0
;
temp dd 0
temp2 dd 0
temp3 dd 0
temp4 dd 0
otv dd 0
 
;for collimg
imgsize:
dd 32
dd 32
 
;massive:
;dd 400 ;elements num
;dd 20 ;size of element in bytes
;rb 400*20
 
 
keymap:
rb 1000
 
;gif_file_area ~21500
gif_file_area2:
file 'phenix.gif'
rb 50
gif_file_area:
file 'star2.gif';include gif file
rb 50 ;50 bytes temp back zone
img_area:
rb 256*64*3+8
ship:
rb 32*32*3+8
shoot:
rb 32*32*3+8
warship1:
rb 32*32*3+8
warship2:
rb 32*32*3+8
meteor:
rb 32*32*3+8
star:
rb 32*32*3+8
star2:
rb 32*32*3+8
star3:
rb 32*32*3+8
box:
rb 32*32*3+8
 
gif_hash_area:
rd 4096+1 ;hash area size for unpacking GIF
 
massive:
rd massize ;elements num
rd elemsize ;size of element in bytes
rb massize*elemsize
 
objmas:
rd omassize ;elements num
rd oelemsize ;size of element in bytes
rb omassize*oelemsize
 
canvas:
canvas_x:
rd 1
canvas_y:
rd 1
rb (640*440*3)+2000
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/phenix/trunk/phenix.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/phenix/trunk/star2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/pic4/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm pic4.asm pic4
@pause
/programs/pic4/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm pic4.asm pic4
@pause
/programs/pic4/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pic4/trunk/pic4.asm
0,0 → 1,707
;
; BACKGROUND SET - Compile with fasm
;
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; version
dd START ; program start
dd I_END ; image size
dd 0x80000 ; reguired amount of memory
dd 0x80000 ; stack pointer
dd I_Param,0
 
include 'lang.inc'
include 'macros.inc'
 
START:
 
call check_parameters
call draw_window
 
call load_texture
call draw_image
 
still:
 
mov eax,10 ; wait here for event
int 0x40
cmp eax,1
jz red
cmp eax,2
jz key
cmp eax,3
jz button
jmp still
 
key:
mov eax,2
int 0x40
jmp still
 
red:
call draw_window
jmp still
 
button:
mov eax,17
int 0x40
 
shr eax,8
and eax,255
 
cmp eax,101 ; tiled
jne no101
mov eax,15
mov ebx,4
mov ecx,1
int 0x40
mov eax,15
mov ebx,3
int 0x40
jmp still
no101:
 
cmp eax,102 ; stretch
jne no102
mov eax,15
mov ebx,4
mov ecx,2
int 0x40
mov eax,15
mov ebx,3
int 0x40
jmp still
no102:
 
cmp eax,1 ; end program
jnz noproend
or eax,-1
int 0x40
noproend:
 
cmp eax,11
jz bg
cmp eax,12
jz bg
cmp eax,13
jz bg
 
cmp eax,121
jb no_bg_select
cmp eax,133
jg no_bg_select
sub eax,121
shl eax,2
add eax,arrays
mov eax,[eax]
mov [usearray],eax
call load_texture
call draw_image
jmp still
no_bg_select:
 
cmp eax,14+20
jge bg4
 
jmp bg2
 
 
set_default_colours:
 
pusha
 
mov eax,6 ; load default color map
mov ebx,defcol
mov ecx,0
mov edx,-1
mov esi,0x8000
int 0x40
 
mov eax,48 ; set default color map
mov ebx,2
mov ecx,0x8000
mov edx,10*4
int 0x40
 
popa
ret
 
defcol db 'DEFAULT.DTP'
 
 
check_parameters:
 
cmp [I_Param],dword 'BOOT'
je @f
ret
@@:
 
call set_default_colours
call load_texture
 
mov eax,15
mov ebx,1
mov ecx,256
mov edx,256
int 0x40
 
mov eax,15
mov ebx,5
mov ecx,0x40000+1
mov edx,0
mov esi,256*3*256
int 0x40
 
mov eax,15
mov ebx,4
mov ecx,2
int 0x40
 
mov eax,15
mov ebx,3
int 0x40
 
mov eax,-1
int 0x40
 
 
 
set_picture:
 
mov eax,image+99-3*16
mov ebx,0x40000+255*3+255*3*256
newpix:
mov ecx,[eax]
mov [ebx],cx
shr ecx,16
mov [ebx+2],cl
add eax,3
sub ebx,3
cmp ebx,0x40002
jge newpix
 
ret
 
 
load_texture:
 
call gentexture
call set_picture
 
ret
 
 
; set background
 
bg:
 
mov edi,0x40000
 
cmp eax,12
jnz bb1
mov edi,0x40000+1
bb1:
cmp eax,13
jnz bb2
mov edi,0x40000+2
bb2:
 
mov eax,15
mov ebx,1
mov ecx,256
mov edx,256
int 0x40
 
mov eax,15
mov ebx,5
mov ecx,edi
mov edx,0
mov esi,256*256*3
int 0x40
 
mov eax,15
mov ebx,3
int 0x40
 
jmp still
 
 
; colored background
 
bg2:
 
push eax
 
mov eax,15
mov ebx,1
mov ecx,8
mov edx,8
int 0x40
 
mov eax,[esp]
 
sub eax,14
shl eax,2
 
mov edx,[colors+eax]
 
mov esi,32*32*4
mov edi,0
mov ecx,0
dbl2:
mov eax,15
mov ebx,2
int 0x40
add ecx,3
inc edi
cmp edi,esi
jb dbl2
 
 
mov eax,15
mov ebx,3
int 0x40
 
jmp still
 
 
; shaped background
 
bg4:
 
sub eax,14+20
shl eax,3
add eax,shape
mov ecx,[eax+0]
mov edx,[eax+4]
 
mov eax,15
mov ebx,1
int 0x40
 
mov eax,15
mov ebx,3
int 0x40
 
jmp still
 
 
; *********************************************
; ******* CELLULAR TEXTURE GENERATION *********
; **** by Cesare Castiglia (dixan/sk/mfx) *****
; ********* dixan@spinningkids.org **********
; *********************************************
; * the algorythm is kinda simple. the color *
; * component for every pixel is evaluated *
; * according to the squared distance from *
; * the closest point in 'ptarray'. *
; *********************************************
 
gentexture:
 
mov ecx,0 ; ycounter
mov edi,0 ; pixel counter
 
mov ebp,[usearray]
 
ylup:
mov ebx,0
 
call precalcbar
 
xlup:
push edi
mov edi, 0
mov esi, 512000000 ; abnormous initial value :)
 
pixlup:
push esi
; add edi,4
mov eax,ebx ; evaluate first distance
sub eax, [ebp+edi] ; x-x1
call wrappit
imul eax
mov esi, eax ; (x-x1)^2
mov eax, ecx
add edi,4
sub eax, [ebp+edi] ; y-y1
call wrappit
imul eax ; (y-y1)^2
add eax,esi ; (x-x1)^2+(y-y1)^2
pop esi
 
cmp esi,eax
jb ok ; compare and take the smaller one
mov esi,eax
 
ok:
add edi,4
cmp [ebp+edi],dword 777
jne pixlup
 
mov eax,esi ; now evaluate color...
 
cmp eax,255*24
jbe ok2
; imul eax,12
ok2:
 
mov edi,24 ; 50 = max shaded distance
idiv edi
 
pop edi
mov [image+51+edi],eax
add edi,3
 
add ebx,1 ; bounce x loop
cmp ebx,256 ; xsize
jne xlup
 
add ecx,1
cmp ecx,256 ; ysize
jne ylup
 
ret
 
wrappit:
cmp eax,0 ; this makes the texture wrap
jg noabs
neg eax
noabs:
cmp eax,128
jb nowrap
neg eax
add eax,256
nowrap:
ret
 
precalcbar:
pusha
mov eax,1
mov ebx,ecx
add ebx,18
mov ecx,44
mov edx,0x00000060
bar:
add ecx,2
add edx,0x00020100
; int 0x40
cmp ecx,298
jb bar
popa
ret
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW *********
; *********************************************
 
 
draw_image:
 
mov eax,7
mov ebx,0x40000
mov ecx,256*65536+255
mov edx,19*65536+65;55
int 0x40
 
ret
 
 
y_add equ 44 ; 30
y_s equ 13
 
y_add2 equ 340 ;325
set equ 0 ;15
 
button_color equ 0A0A0A0h ; 207090 306090h
wnd_color equ 3B0B0B0h ; 34090B0h
 
 
draw_window:
 
mov eax, 12 ; tell os about draw
mov ebx, 1
int 0x40
 
mov eax, 0 ; define and draw window
mov ebx, 220*65536+293
mov ecx, 50*65536+408
mov edx, wnd_color
int 0x40
 
call draw_image
 
mov eax,8 ; Blue button
mov ebx,(set+195+27)*65536+17
mov ecx,y_add*65536+y_s
mov edx,11
mov esi,0x004444cc
int 0x40
mov eax,8 ; Red button
mov ebx,(set+213+27)*65536+17
mov edx,12
mov esi,0x00cc4444
int 0x40
mov eax,8 ; Green button
mov ebx,(set+258)*65536+17
mov edx,13
mov esi,0x0044cc44
int 0x40
 
mov eax, 8 ; tiled
mov ebx, 96*65536+63
mov ecx, y_add*65536+y_s
mov edx, 101
mov esi, button_color
int 0x40
 
mov eax, 8 ; stretch
mov ebx, 160*65536+61
mov edx, 102
int 0x40
 
mov eax, 4 ; window header
mov ebx, 8*65536+8
mov ecx, 0x10ffffff
mov edx, header
mov esi, header.size
int 0x40
 
mov ebx, 220*65536+30
mov ecx, 0
mov edx, apply_text
mov esi, apply_text.size
int 0x40
 
mov ebx, 19*65536+326
mov edx, image_buttons_text
mov esi, image_buttons_text.size
int 0x40
 
mov ebx, 19*65536+(y_add2+27)
mov edx, simple_text
mov esi, simple_text.size
int 0x40
 
mov ecx, (y_add2)*65536+20
mov ebx, (18)*65536+25
mov edx, 121
mov esi, button_color
mov edi, 9
mov eax, 8
@@:
int 0x40
add ebx, 29*65536
inc edx
dec edi
jnz @b
 
 
mov edx, 34+4
mov edi, 4
mov eax, 8
mov ebx, 18*65536+18
mov ecx, y_add*65536+y_s
@@:
int 0x40
inc edx
add ebx, 19*65536
dec edi
jnz @b
 
 
;-----------------------
mov edx,14 ; button number
mov ebx,(18)*65536+17 ; button start x & size
mov ecx,(y_add2+40)*65536+14 ; button start y & size
 
newcb:
push edx
sub edx,14
shl edx,2
add edx,colors
mov esi,[edx]
pop edx
 
mov eax,8
int 0x40
 
inc edx
add ebx,20*65536
add esi,5*256*256
 
cmp edx,27
jnz newcb
;-----------------------
 
mov eax, 4
mov ebx, 8*65536+4+y_add
mov ecx, 0
mov edx, la2
mov esi, la2.size
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
 
 
; DATA SECTION
 
lsz header,\
ru, "ƒ¥­¥à â®à ä®­  à ¡®ç¥£® á⮫ ",\
en, "BACKGROUND"
 
lsz apply_text,\
ru, "à¨¬¥­¨âì:",\
en, "Apply:"
 
lsz image_buttons_text,\
ru, "‚ë¡¥à¨â¥ ®¡à §¥æ:",\
en, "Select pattern:"
 
lsz simple_text,\
ru, "Ž¤­®æ¢¥â­ë© ä®­:",\
en, "Single-color background:"
 
lsz la2,\
ru, " ‡€ŒŽ‘’ˆ’œ €‘’Ÿ“’œ",\
en, " TILED STRETCH"
 
 
xx db 'x'
 
colors:
dd 0x770000
dd 0x007700
dd 0x000077
dd 0x777700
dd 0x770077
dd 0x007777
dd 0x777777
dd 0x335577
dd 0x775533
dd 0x773355
dd 0x553377
dd 0x000000
dd 0xcccccc
 
 
shape:
 
dd 1024,64
dd 1024,32
dd 2048,32
dd 4096,32
 
dd 512,16
dd 1024,16
dd 2048,16
dd 4096,16
 
dd 64,32
dd 64,16
dd 32,32
dd 8,8
dd 16,16
dd 64,64
 
usearray dd ptarray
 
arrays dd ptarray,ptarray2,ptarray3,ptarray4,ptarray5,ptarray6
dd ptarray7,ptarray8,ptarray9
 
ptarray:
 
dd 150,50
dd 120,30
dd 44,180
dd 50,66
dd 27,6
dd 95,212
dd 128,177
dd 201,212
dd 172,201
dd 250,100
dd 24,221
dd 11,123
dd 248,32
dd 34,21
dd 777 ; <- end of array
 
ptarray2:
 
dd 0,0,50,50,100,100,150,150,200,200,250,250
dd 50,150,150,50,200,100,100,200
dd 777
 
ptarray3:
 
dd 55,150,150,55,200,105,105,200
dd 30,30,220,220
dd 777
 
ptarray4:
 
dd 196,0,196,64,196,128,196,196
dd 64,32,64,96,64,150,64,228
dd 777
 
ptarray5:
 
dd 196,0,196,64,196,128,196,196
dd 64,0,64,64,64,128,64,196
dd 777
 
ptarray6:
 
dd 49,49,128,50,210,50
dd 50,128,128,128,210,128
dd 50,210,128,210,210,210
 
dd 777
 
ptarray7:
 
dd 0,0
dd 196,196,64,64
dd 128,0
dd 0,128
dd 64,64,196,64
dd 196,196,64,196
dd 128,128
 
dd 777
 
ptarray8:
 
dd 0, 128
dd 0, 128
dd 128, 0
dd 0, 128
dd 128, 0
dd 0, 128
dd 128, 0
dd 0, 128
dd 128, 0
dd 128, 128
 
dd 777
 
ptarray9:
 
 
dd 0,248,64,128,128,64,196,48,160,160,94,224,240,96,5,5,777
 
 
 
I_Param:
 
image:
 
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/plasma/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm plasma.asm plasma
@pause
/programs/plasma/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm plasma.asm plasma
@pause
/programs/plasma/trunk/graph8.inc
0,0 → 1,16
blit_8_to_32:
mov esi,virtual_screen_8 ; ESI=src
mov edi,virtual_screen_32 ; EDI=dst
mov ecx,WND_SIZE_X*WND_SIZE_Y ; ECX=size
.blit_next:
xor eax,eax ; EAX=byte to blit
mov al,[esi]
shl eax,2
mov eax,[_palette+eax]
mov [edi],ax
shr eax,16
mov [edi+2],al
inc esi
add edi,3
loop .blit_next
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/plasma/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/plasma/trunk/plasma.asm
0,0 → 1,186
; Originally written by Jarek Pelczar
include "lang.inc"
include "macros.inc"
 
WND_SIZE_X = 320
WND_SIZE_Y = 200
 
MEOS_APP_START
CODE
fninit
mov al,40
mov bl,101b
int 0x40
call init_palette
call init_texture
jmp .paint_window
.event_loop:
mov al,23
mov ebx,1
int 0x40
test eax,eax
je .draw_screen
dec eax
je .paint_window
 
or eax,-1
int 0x40
 
.draw_screen:
call blit_8_to_32
mov al,7
mov ebx,virtual_screen_32
mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y
mov edx,(4 shl 16)+24
int 0x40
call rotate_pal
jmp .event_loop
 
.paint_window:
mov al,12
push eax
xor ebx,ebx
inc ebx
int 0x40
 
xor eax,eax
mov ebx,(100 shl 16)+(WND_SIZE_X+8)
mov ecx,(100 shl 16)+(WND_SIZE_Y+28)
mov edx,0x03000000
int 0x40
 
mov al,7
mov ebx,virtual_screen_32
mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y
mov edx,(4 shl 16)+24
int 0x40
 
mov al,4
mov ebx,0x00060006
mov ecx,0x10ffffff
mov edx,window_title
mov esi,window_title_len
int 0x40
 
pop eax
and ebx,2 ; bit 1 is set
int 0x40
 
jmp .event_loop
 
init_palette:
mov edi,_palette
mov ecx,64
xor eax,eax
.color1:
inc ah
mov al,ah
stosb
xor al,al
stosb
stosb
inc edi
loop .color1
mov ecx,64
push ecx
xor eax,eax
.color2:
mov al,63
stosb
mov al,ah
stosb
xor al,al
stosb
inc ah
inc edi
loop .color2
pop ecx
push ecx
xor eax,eax
.color3:
mov al,63
stosb
stosb
mov al,ah
stosb
inc ah
inc edi
loop .color3
pop ecx
mov eax,0x003f3f3f
rep stosd
ret
 
init_texture:
fldpi
mov [_fpom16],180
fidiv [_fpom16]
fstp [_st_rad]
mov edi,virtual_screen_8
cdq
.itex_vertical:
xor ecx,ecx
fld [_st_rad]
mov [_fpom16],5
fimul [_fpom16]
mov [_fpom16],dx
fimul [_fpom16]
fsin
fmul [_multiplier]
fstp [_fpom32]
.itex_horizontal:
fld [_st_rad]
mov [_fpom16],3
fimul [_fpom16]
mov [_fpom16],cx
fimul [_fpom16]
fsin
fmul [_multiplier]
fadd [_fpom32]
mov [_fpom16],127
fiadd [_fpom16]
fistp [_fpom16]
mov ax,[_fpom16]
inc eax
stosb
inc ecx
cmp ecx,WND_SIZE_X
jne .itex_horizontal
inc edx
cmp edx,WND_SIZE_Y
jne .itex_vertical
ret
 
rotate_pal:
mov ebx,[_palette+4]
mov edi,_palette+4
mov esi,_palette+8
xor ecx,ecx
mov cl,255
; cld
rep movsd
mov [_palette+1020],ebx
ret
 
include "graph8.inc"
 
DATA
_multiplier dd 63.5
 
window_title:
db 'Plasma'
window_title_len = $ - window_title
 
UDATA
_fpom32 rd 1
_fpom16 rw 1
_st_rad rd 1
_palette: rd 256
 
virtual_screen_8:
rb WND_SIZE_X*WND_SIZE_Y
 
virtual_screen_32:
rb WND_SIZE_X*WND_SIZE_Y*3
 
MEOS_APP_END
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pong/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
_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
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
 
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pong/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pong/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm pong.asm pong
@pause
/programs/pong/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm pong.asm pong
@pause
/programs/pong/trunk/pong.asm
0,0 → 1,381
;
; Pong Gaem 2Ver Mini Sample by Pavlushin Evgeni for ASCL
; www.waptap@mail.ru
;
 
 
;******************************************************************************
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 temp_area , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
;5941 ;4523(with new random)
 
 
 
include 'lang.inc'
include 'ascl.inc'
include 'ascgl.inc'
 
START: ; start of execution
call draw_window
 
loadbmp '/RD/1/MFAR.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img
loadbmp '/RD/1/COPY.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img2
loadbmp '/RD/1/SMILE.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img3
 
fullimg img4 , 32 ,32 ,0x00000000 ;black
 
loadbmp '/RD/1/MBAR_I3.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img5
 
 
still:
 
mov eax,11 ; scan 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
 
out_scorea:
mov eax,47
mov ebx,5*65536
mov ecx,[scorea]
mov edx,300*65536+8
mov esi,cl_Blue
int 0x40
out_scoreb:
mov eax,47
mov ebx,5*65536
mov ecx,[scoreb]
mov edx,350*65536+8
mov esi,cl_Red
int 0x40
 
del_images:
setimg dword [ply1x],dword [ply1y],img4
setimg dword [ply2x],dword [ply2y],img4
setimg dword [ballx],dword [bally],img4
setimg dword [gravx],dword [gravy],img4
 
 
move_images:
 
x_move:
mov eax,dword [ply1rx]
cmp dword [ply1x],eax
je no_m
cmp dword [ply1x],eax
ja m_m
m_p:
add dword [ply1x],4
jmp no_m
m_m:
sub dword [ply1x],4
no_m:
 
 
y_move:
mov eax,dword [ply1ry]
cmp dword [ply1y],eax
je no_m2
cmp dword [ply1y],eax
ja m_m2
m_p2:
add dword [ply1y],2
jmp no_m2
m_m2:
sub dword [ply1y],2
no_m2:
 
;automove ball
mov eax,dword [ballxv]
add dword [ballx],eax
mov eax,dword [ballyv]
add dword [bally],eax
 
 
;autoslow ball
cmp dword [ballxv],0
jl ballb
balla:
cmp dword [ballxv],2
jng balln
dec dword [ballxv]
; mov dword [ballxv],2
jmp balln
 
ballb:
cmp dword [ballxv],-2
jng balln
inc dword [ballxv]
; mov dword [ballxv],-2
jmp balln
 
balln:
 
cmp dword [ballyv],2
jng by_n
dec dword [ballyv]
by_n:
 
;test ball on collusion of screen
; cmp dword [bally],480+16-32
; jna ya_ok
; neg dword [ballyv]
;ya_ok:
; cmp dword [bally],30
; jnb yb_ok
; neg dword [ballyv]
;yb_ok:
cmp dword [ballx],640-32
jna xa_ok
neg dword [ballxv]
xa_ok:
cmp dword [ballx],6
jnb xb_ok
neg dword [ballxv]
xb_ok:
 
;if ball far out of screen come back
; is not work already
cmp dword [bally],466
jng yax_ok
call draw_window
inc dword [scoreb]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok:
cmp dword [bally],30
jnl yax_ok2
call draw_window
inc dword [scorea]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok2:
 
xorx:
cmp dword [ballxv],0
jne norx
random 5,dword [ballxv]
sub dword [ballxv],2
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]
add dword [bally],18
; neg dword [ballxv]
not_coll:
 
;test on collusion com of ball
collusion_com:
collimg img,[ply2x],[ply2y],img3,[ballx],[bally],eax
cmp eax,1
jne not_collcom
neg dword [ballyv]
sub dword [bally],18
; neg dword [ballxv]
not_collcom:
 
;test on collusion gravity of ball
collusion_grav:
collimg img,[gravx],[gravy],img3,[ballx],[bally],eax
cmp eax,1
jne not_collg
neg dword [ballyv]
 
; mov dword [ballxv],-20
 
cmp dword [ballyv],0
jl ab
jg bf
jmp not_collgx
ab:
sub dword [ballyv],30
jmp not_collgx
bf:
add dword [ballyv],30
not_collgx:
cmp dword [ballxv],0
jl abx
jg bfx
jmp not_collg
abx:
sub dword [ballxv],10
jmp not_collg
bfx:
add dword [ballxv],10
 
 
; mov dword [ballyv],20
not_collg:
 
;com move
cx_move:
cmp dword [bally],200
jna cno_m
mov eax,dword [ballx]
cmp dword [ply2x],eax
je cno_m
cmp dword [ply2x],eax
ja cm_m
cm_p:
add dword [ply2x],3
jmp cno_m
cm_m:
sub dword [ply2x],3
cno_m:
 
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]
add ebx,20
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],img
setimg dword [ply2x],dword [ply2y],img2 ;2
setimg dword [ballx],dword [bally],img3
setimg dword [gravx],dword [gravy],img5
 
 
delay 2 ;don't generate delay for fast speed programm
 
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],16
no_l:
cmp ah,key_Right
jne no_r
add dword [ply1rx],16
no_r:
cmp ah,key_Up
jne no_u
sub dword [ply1ry],16
no_u:
cmp ah,key_Down
jne no_d
add dword [ply1ry],16
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:
jmp still
 
 
draw_window:
startwd
window 0,0,640+8,480+24,window_Skinned
label 12,8,'PONG: USE ARROW KEYS SCORE',cl_White+font_Big
endwd
ret
 
 
; DATA AREA
xt dd 100
yt dd 100
 
gravtime dd 10
gravx dd 1000
gravy dd 1000
 
ply1rx dd 200
ply1ry dd 50
 
ply1x dd 200
ply1y dd 50
 
ply2x dd 200
ply2y dd 400
 
ballx dd 200
bally dd 200
 
ballyv dd 3
ballxv dd 3
 
scorea dd 0
scoreb dd 0
 
counter dd 0
tsoi dd 0
 
IM_END:
 
img:
rd 32*32*3+8
img2:
rb 32*32*3+8
img3:
rb 32*32*3+8
img4:
rb 32*32*3+8
img5:
rb 32*32*3+8
 
temp_area:
rb 0x15000
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pong3/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
_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
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
 
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pong3/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:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pong3/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/pong3/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm pong3.asm pong3
@pause
/programs/pong3/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm pong3.asm pong3
@pause
/programs/pong3/trunk/pong.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/pong3/trunk/pong3.asm
0,0 → 1,357
;
; Pong Gaem 3Ver Mini Sample by Pavlushin Evgeni for ASCL
; www.waptap@mail.ru
;
; Not use bmpfile!
 
;******************************************************************************
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 temp_area , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
 
 
include 'ascl.inc'
include 'ascgl.inc'
include 'ascgml.inc'
 
 
START: ; start of execution
call draw_window
 
; loadbmp '/RD/1/PONG.BMP',temp_area,I_END,tsoi
convbmp pongfile,tsoi
bmptoimg pongfile,tsoi,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
 
 
 
still:
 
scevent red,key,button
 
outcount dword [scoreb],300,8,cl_Blue,5*65536
outcount dword [scorea],350,8,cl_Red,5*65536
 
del_images:
setimg dword [ply1x],dword [ply1y],img4
setimg dword [ply2x],dword [ply2y],img4
setimg dword [ballx],dword [bally],img6
setimg dword [gravx],dword [gravy],img4
 
move_ply1:
 
correct [ply1x],[ply1rx],4
correct [ply1y],[ply1ry],2
 
;automove ball
mov eax,dword [ballxv]
add dword [ballx],eax
mov eax,dword [ballyv]
add dword [bally],eax
 
 
;autoslow ball
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],640-32
jna xa_ok
neg dword [ballxv]
xa_ok:
cmp dword [ballx],6
jnb xb_ok
neg dword [ballxv]
xb_ok:
 
;if ball far out of screen come back
; is not work already
cmp dword [bally],466
jng yax_ok
call draw_window
inc dword [scoreb]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok:
cmp dword [bally],30
jnl yax_ok2
call draw_window
inc dword [scorea]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok2:
 
xorx:
cmp dword [ballxv],0
jne norx
random 5,dword [ballxv]
sub dword [ballxv],2
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]
add dword [bally],4
; neg dword [ballxv]
not_coll:
 
;test on collusion com of ball
collusion_com:
collimg img,[ply2x],[ply2y],img3,[ballx],[bally],eax
cmp eax,1
jne not_collcom
neg dword [ballyv]
sub dword [bally],4
; neg dword [ballxv]
not_collcom:
 
;test on collusion gravity of ball
collusion_grav:
collimg img,[gravx],[gravy],img3,[ballx],[bally],eax
cmp eax,1
jne not_collg
neg dword [ballyv]
 
; mov dword [ballxv],-20
 
cmp dword [ballyv],0
jl ab
jg bf
jmp not_collgx
ab:
sub dword [ballyv],25
jmp not_collgx
bf:
add dword [ballyv],25
not_collgx:
cmp dword [ballxv],0
jl abx
jg bfx
jmp not_collg
abx:
sub dword [ballxv],8 ;15
jmp not_collg
bfx:
add dword [ballxv],8
 
 
; mov dword [ballyv],20
not_collg:
 
;ply contorl
cmp dword [ply1rx],560
jna plyok
cmp dword [ply1rx],12000
jna paa
mov dword [ply1rx],4
jmp plyok
paa:
mov dword [ply1rx],560
plyok:
 
 
;com contorl
cmp dword [ply2x],560
jna cplyok
cmp dword [ply2x],12000
jna cpaa
mov dword [ply2x],4
jmp cplyok
cpaa:
mov dword [ply2x],560
cplyok:
 
 
;com move
cx_move:
cmp dword [bally],160
jna cno_m
mov eax,dword [ballx]
sub eax,30
cmp dword [ply2x],eax
je cno_m
cmp dword [ply2x],eax
ja cm_m
cm_p:
add dword [ply2x],3
jmp cno_m
cm_m:
sub dword [ply2x],3
cno_m:
 
;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]
add ebx,10
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],img
setimg dword [ply2x],dword [ply2y],img2 ;2
setimg dword [ballx],dword [bally],img3
setimg dword [gravx],dword [gravy],img5
 
 
delay 1 ;don't generate delay for fast speed programm
 
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],32 ;16
no_l:
cmp ah,key_Right
jne no_r
add dword [ply1rx],32 ;16
no_r:
cmp ah,key_Up
jne no_u
sub dword [ply1ry],16
no_u:
cmp ah,key_Down
jne no_d
add dword [ply1ry],16
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:
jmp still
 
 
draw_window:
startwd
window 0,0,640+8,480+24,window_Skinned
label 12,8,'PONG: USE ARROW KEYS SCORE',cl_White+font_Big
endwd
ret
 
 
; DATA AREA
xt dd 100
yt dd 100
 
gravtime dd 10
gravx dd 1000
gravy dd 1000
 
ply1rx dd 200
ply1ry dd 50
 
ply1x dd 200
ply1y dd 50
 
ply2x dd 200
ply2y dd 400
 
ballx dd 200
bally dd 200
 
ballyv dd 3
ballxv dd 3
 
scorea dd 0
scoreb dd 0
 
counter dd 0
tsoi dd 0
 
pongfile:
file 'pong.bmp'
 
IM_END:
 
temp:
rb 20000
 
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 32*32*3+8
img6:
rb 15*15*3+8
 
temp_area:
rb 0x15000
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/popc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm popc.asm popc
@pause
/programs/popc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm popc.asm popc
@pause
/programs/popc/trunk/popc.asm
0,0 → 1,1029
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; POP CLIENT for MenuetOS ;;
;; - Modified from IRC client ;;
;; ;;
;; License: GPL / See file COPYING for details ;;
;; Copyright 2002 (c) Ville Turjanmaa ;;
;; ;;
;; Compile with FASM for Menuet ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
include 'lang.inc'
version equ '0.1'
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x200000 ; required amount of memory
dd 0xffff0
dd 0,0
 
START: ; start of execution
 
mov [file_start],0x100000
 
mov eax,58
mov ebx,filel
int 0x40
 
cmp eax,0
jne notfound
add [file_start],ebx
notfound:
 
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:
 
mov eax,5
mov ebx,1
int 0x40
 
mov eax,11 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw
je redraw
cmp eax,2 ; key
je 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_server_data
no_main_update:
 
cmp [server_active],0
je noread
call read_incoming_data
noread:
 
call print_status
 
cmp [status],4
je send_request
 
jmp still
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Save the fetched mails
;;
 
 
save_file:
 
pusha
 
mov edi,[file_start]
 
mov eax,[file_start]
sub eax,0x100000
mov [files+8],eax
 
mov eax,58
mov ebx,files
int 0x40
 
popa
 
ret
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Send user id/passwd/mailrq
;;
 
 
send_request:
 
inc [mcounter]
 
cmp [mcounter],1000
jbe no_send
 
mov eax,[ccounter]
imul eax,32
add eax,getmail
mov esi,eax
 
inc [ccounter]
 
mov edx,32
 
cmp [ccounter],1
jne no1
mov edx,5+2
add edx,[l2]
no1:
 
cmp [ccounter],2
jne no2
mov edx,5+2
add edx,[l3]
no2:
 
mov eax,53
mov ebx,7
mov ecx,[socket]
int 0x40
mov [mcounter],0
 
cmp [esi],dword 'quit'
je close_fetch
 
 
no_send:
 
jmp still
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Close connection to server
;;
 
 
close_fetch:
 
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,14
mov esi,quitc
int 0x40
mov [mcounter],0
 
mov eax,5
mov ebx,150
int 0x40
 
call read_incoming_data
 
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
 
mov eax,5
mov ebx,2
int 0x40
 
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
 
mov [server_active],0
 
jmp still
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; User input processing
;;
 
 
redraw: ; redraw
 
call draw_window
jmp still
 
 
key:
 
mov eax,2
int 0x40
 
jmp still
 
 
button: ; button
 
mov eax,17 ; get id
int 0x40
 
cmp ah,60
jne no_open
mov eax,19
mov ebx,tp
mov ecx,pr
int 0x40
jmp still
no_open:
 
cmp ah,1 ; close program
jne noclose
mov eax,-1
int 0x40
noclose:
 
cmp ah,51
je read_string
cmp ah,52
je read_string
cmp ah,53
je read_string
 
call socket_commands
 
jmp still
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Socket open & close
;;
 
socket_commands:
 
cmp ah,22 ; open socket
jnz tst3
 
mov [server_active],1
 
mov [mcounter],900
mov [ccounter],0
 
mov eax,3
int 0x40
 
mov eax,3
int 0x40
mov ecx,eax
and ecx,0xffff
 
mov eax,53
mov ebx,5
mov edx,110
mov esi,dword [ip]
mov edi,1
int 0x40
mov [socket], eax
 
ret
tst3:
 
 
cmp ah,24 ; close socket
jnz no_24
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
mov [header_sent],0
mov [mail_rp],0
mov [server_active],0
 
ret
no_24:
 
ret
 
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Display connection status
;;
 
old_status dd 0x0
 
print_status:
 
pusha
 
mov eax,53
mov ebx,6
mov ecx,[socket]
int 0x40
 
mov [status],eax
 
cmp eax,[old_status]
je nopr
 
mov [old_status],eax
 
push eax
 
mov eax,13
mov ebx,200*65536+30
mov ecx,160*65536+10
mov edx,0xffffff
int 0x40
 
pop ecx
 
cmp [server_active],1
jne nopr
 
mov eax,47
mov ebx,3*65536
mov edx,200*65536+160
mov esi,0x000000
int 0x40
 
nopr:
 
popa
 
ret
 
 
 
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Read data from server
;;
 
 
read_incoming_data:
 
pusha
 
read_new_byte:
 
call read_incoming_byte
cmp ecx,-1
je no_data_in_buffer
 
mov eax,[file_start]
mov [eax],bl
inc [file_start]
 
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 save_file
call analyze_data
mov edi,command
mov ecx,250
mov eax,0
cld
rep stosb
mov [cmd],0
no_end_command:
 
mov eax,[cmd]
cmp eax,250
jge still
 
mov [eax+command-2],bl
inc [cmd]
 
jmp read_new_byte
 
no_data_in_buffer:
 
popa
 
ret
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Read user input for ip/user/passwd
;;
 
 
read_string:
 
shr eax,8
sub eax,51
mov ebx,eax
imul eax,12
add eax,181
 
mov [len],ebx
shl [len],2
add [len],l1
 
imul ebx,50
add ebx,input1
 
mov [addr],ebx
mov [ya],eax
 
mov edi,[addr]
mov eax,0
mov ecx,30
cld
rep stosb
 
call print_input_text
 
mov edi,[addr]
 
f11:
mov eax,10
int 0x40
cmp eax,2
jne read_done
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je read_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
sub edi,1
mov [edi],byte 32
call print_text
jmp f11
nobsl:
mov [edi],al
 
call print_input_text
 
add edi,1
mov esi,[addr]
add esi,30
cmp esi,edi
jnz f11
 
read_done:
 
push edi
 
mov ecx,40
mov eax,32
cld
rep stosb
 
call print_input_text
 
pop edi
sub edi,[addr]
mov eax,[len]
mov [eax],edi
 
cmp [len],l1
jne noip
mov esi,input1
mov edi,ip_text+15
mov ecx,16
cld
rep movsb
call ip_set
noip:
 
cmp [len],l2
jne nol2
mov esi,input2
mov edi,l2_text+15
mov ecx,22
cld
rep movsb
mov esi,input2
mov edi,getmail+5
mov ecx,[l2]
cld
rep movsb
mov al,13
stosb
mov al,10
stosb
nol2:
 
cmp [len],l3
jne nol3
mov esi,input3
mov edi,getmail+32+5
mov ecx,[l3]
cld
rep movsb
mov al,13
stosb
mov al,10
stosb
nol3:
 
call draw_window
 
jmp still
 
 
 
print_input_text:
 
pusha
 
mov eax,13
mov ebx,95*65536+23*6
mov ecx,[ya]
shl ecx,16
mov cx,9
mov edx,0xffffff
int 0x40
 
cmp [len],l3
je noprt
 
mov eax,4
mov edx,[addr]
mov ebx,95*65536
add ebx,[ya]
mov ecx,0x000000
mov esi,23
int 0x40
 
noprt:
 
popa
ret
 
 
ip_set:
 
mov esi,input1-1
mov edi,ip
xor eax,eax
ip1:
inc esi
cmp [esi],byte '0'
jb ip2
cmp [esi],byte '9'
jg ip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp ip1
ip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,ip+3
jbe ip1
ret
no_read_ip:
 
ret
 
 
analyze_data:
 
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
 
cmp [cmd],2
jbe nott
mov ecx,[cmd]
sub ecx,2
mov esi,command+0
newcmdc:
mov bl,[esi]
call print_character
inc esi
loop newcmdc
 
nott:
 
mov edx,I_END
call draw_server_data
 
cmd_len_ok:
 
cmp [command],dword '-ERR'
je close_fetch
 
cmp [command],word '+O'
jne nook
mov [mcounter],990
nook:
 
popa
 
ret
 
 
 
draw_data:
 
push eax
 
add eax,[text_start]
mov [eax],bl
 
pop eax
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
 
 
 
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
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Window definitions
;;
 
 
 
draw_window:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0 ; draw window
mov ebx,5*65536+435
mov ecx,5*65536+232
mov edx,[wcolor]
add edx,0x03ffffff
mov esi,0x80555599
mov edi,0x00ffffff
int 0x40
 
mov [old_status],300
 
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,23*65536+22
mov ecx,155*65536+10
mov edx,22
mov esi,0x44cc44
int 0x40
 
mov eax,8 ; button: close socket
mov ebx,295*65536+22
mov ecx,155*65536+10
mov edx,24
mov esi,0xcc4444
int 0x40
 
mov eax,8 ; button: text entries
mov ebx,243*65536+8
mov ecx,180*65536+8
mov edx,51
mov esi,0x4488dd
newi:
int 0x40
inc edx
add ecx,12*65536
cmp edx,53
jbe newi
 
mov eax,8 ; open inbox
mov ebx,295*65536+102
mov ecx,190*65536+14
mov edx,60
mov esi,0x5577dd
int 0x40
 
mov eax,38 ; line
mov ebx,5*65536+430
mov ecx,114*65536+114
mov edx,0x000000
int 0x40
 
mov ebx,5*65536+133 ; 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_server_data
 
mov eax,12
mov ebx,2
int 0x40
 
popa
 
ret
 
 
draw_server_data:
 
pusha
 
mov eax,4
mov ebx,10*65536+26
mov ecx,8
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
int 0x40
add edx,[rxs]
add ebx,10
pop ecx
loop dct
 
popa
ret
 
 
 
text:
 
db ' Incoming mails are written to /rd/1/popc.txt '
db ' '
db ' Check for mail. Force close '
db ' '
ip_text:
db ' Server IP : 192.168.1.200 < '
l2_text:
db ' User : < Open popc.txt '
l3_text:
db ' Password : (not shown) < '
 
db 'x <- END MARKER, DONT DELETE '
 
file_start dd 0x100000
 
files:
dd 1,0,0,0x100000,0xd0000
db '/rd/1/popc.txt',0
filel:
dd 0,0,10000/512,0x100000,0xd0000
db '/rd/1/popc.txt',0
 
ip db 192,168,1,200
 
socket dd 0x0
 
posx dd 0x0
incoming_pos dd 0x0
incoming_string: times 128 db 0
pos dd 0x0
 
text_start dd I_END
print db 0x0
cmd dd 0x0
rxs dd 66
 
res: db 0,0
command: times 256 db 0x0
 
command_position dd 0
counter dd 0
 
numtext db ' '
wcolor dd 0x000000
labelt db 'POP client v ',version
labellen:
scroll: dd 1,8
 
tp: db 'TINYPAD '
pr: db 'POPC TXT',0
 
 
getmail:
db 'user xyz ',13,10
db 'pass xyz ',13,10
db 'retr 1 ',13,10
db 'retr 2 ',13,10
db 'retr 3 ',13,10
db 'retr 4 ',13,10
db 'retr 5 ',13,10
db 'retr 6 ',13,10
db 'retr 7 ',13,10
db 'retr 8 ',13,10
db 'retr 9 ',13,10
 
quitc:
db 'quit ',13,10
 
mcounter dd 900
ccounter dd 0
 
ld db 13,10
 
server_active db 0
 
header_sent db 0
 
close_connection dd 0x0
 
mail_rp dd 0
 
irc_data dd 0x0
addr dd 0x0
ya dd 0x0
len dd 0x0
 
input1: times 50 db 32
input2: times 50 db 32
input3: times 50 db 32
 
l1 dd 0
l2 dd 3
l3 dd 3
 
status dd 0x0
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ppp/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm ppp.asm ppp
@pause
/programs/ppp/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ppp.asm ppp
@pause
/programs/ppp/trunk/chat.inc
0,0 → 1,188
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; CHAT.INC ;;
;; ;;
;; Modem Chat Initiator for PPP Dialer ;;
;; ;;
;; Version 3 2nd May 2003 ;;
;; ;;
;; Copyright 2002 Shrirang Bhagwat, b_shrirang@hotmail.com ;;
;; ;;
;; See file COPYING for details ;;
;; ;;
;; 2/5/03 - Shrirang - Added Abort Strings For sendwait ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Request And Response Chat Strings
; Following Data Structure is used for Request Response Chatting
; with the modem, for each request there is an expected response
; chatreq <-> chatres, 0 (NULL) is delimeter for 1 string
; '`' is delimiter for the section, modify according to your
; modem dialing scheme; in future MenuetOS might provide a graphical
; client to generate this kind of data structure and the PAP packet
; for username and password!
; Aborts strings are used to get outta sendwait early...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; REQUESTS
chatreq db 'ATH',13,0 ; 0 (NULL) is required by sendwait
db 'ATZ',13,0
db 'ATM1',13,0
db 'ATX1',13,0 ; My Modem doesn't connect without this
; db 'ATDT;',13,0
db 'ATDT phonenumber',13,0
db '`' ; <- End Marker
 
; RESPONSES
chatres db 'OK',0
db 'OK',0
db 'OK',0
db 'OK',0
; db 'OK',0
db 'CONNECT',0
db '`' ; <- End Marker
 
; ABORTS
aborts db 'ERROR',0
db 'NO CARRIER',0
db 'NO DIALTONE',0
db 'BUSY',0
db 'LINE IN USE',0
db 'NO ANSWER',0
db '`' ; <- End Marker
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; modem_chat - chats with the modem to initiate a connection
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
modem_chat:
 
push edi
push esi
push edx
 
mov edi, chatreq ; init everytime, safe, stateless
mov esi, chatres
 
chat_now:
 
cmp byte [esi], '`' ; are we done?
je chatover
 
mov edx, 6000 ; strings like "atdt;" take long on my modem
call sendwait
 
and eax, eax
jz timeoutoccured
 
updatereq:
 
inc edi
cmp byte [edi], '`'
je updateres
 
cmp byte [edi], 0
jne updatereq
 
inc edi
 
updateres:
 
inc esi
cmp byte [esi], '`'
je chatover
 
cmp byte [esi], 0
jne updateres
 
inc esi
 
jmp chat_now
 
 
chatover:
 
xor eax, eax ; SUCCESS!
inc eax
 
pop edx
pop esi
pop edi
 
ret
 
timeoutoccured:
 
xor eax, eax ; FAIL!
 
pop edx
pop esi
pop edi
 
ret
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; scanaborts - scans the response from modem for abort srings
; ESI - Response from modem
; EDI - Pointer to Abort Table
; ECX - Response Length
; Returns 1 if abort detected, 0 otherwise
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
scanaborts:
 
push esi
push edi
push ecx
 
checkit:
 
push esi
repe cmpsb ; any abort matches?
je abortdetected
pop esi
 
 
updatetbl:
 
inc edi
cmp byte [edi], '`'
je noabortfound
 
cmp byte [edi], 0
jne updatetbl
 
inc edi
 
jmp checkit
 
abortdetected:
 
pop esi
pop ecx
pop edi
pop esi
 
xor eax, eax ; SUCCESS!
inc eax
ret
 
noabortfound :
 
pop ecx
pop edi
pop esi
 
 
xor eax, eax ; FAILED!
ret
 
 
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ppp/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ppp/trunk/ppp.asm
0,0 → 1,2255
;
; PPP.ASM
;
; Compile with FASM for Menuet
; This program dials into an ISP and establishes a PPP connection
;
; Version 11 26th January 2004
;
; This code is a port of the PPP dialer program by Microchip, from
; their application note AN724
; It has been ported by Mike Hibbett mikeh@oceanfree.net for Menuet
;
; 26/1/04 - Mike Hibbett - added support for com port selected by
; stackcfg
; 2/5/03 - Shrirang - Added Abort Strings To sendwait to get out early
; if modem sends abort strings like NO CARRIER etc.
;
; The original copyright statement follows
;//////////////////////////////////////////////////////////////////////////
;//
;//PING.C version 1.10 July 29/99 (C)opyright by Microchip Technology Inc
;//
;//////////////////////////////////////////////////////////////////////////
 
FALSE equ 0
TRUE equ 1
DEBUG_OUTPUT equ TRUE ; If FALSE, not debugging info outputted
DEBUG_PPP_OUTPUT equ TRUE ; write PPP status msgs to debug board?
DEBUG_PORT2_OUTPUT equ TRUE ; write debug data also to com2
 
 
BAUD_9600 equ 12
BAUD_57600 equ 2
; The next line sets the baud rate of the connection to the modem
BAUDRATE equ BAUD_57600
 
 
LINE_END equ 0x0D ; End of input data character
 
 
; Defines for Internet constants
REQ equ 1 ; Request options list for PPP negotiations
PPP_ACK equ 2 ; Acknowledge options list for PPP negotiations
PPP_NAK equ 3 ; Not acknowledged options list for PPP neg
REJ equ 4 ; Reject options list for PPP negotiations
TERM equ 5 ; Termination packet for LCP to close connectio
LCP_ECHO_REQ equ 9
LCP_ECHO_REP equ 10
IP equ 0x0021 ; Internet Protocol packet
IPCP equ 0x8021 ; Internet Protocol Configure Protocol packet
CCP equ 0x80FD ; Compression Configure Protocol packet
LCP equ 0xC021 ; Link Configure Protocol packet
PAP equ 0xC023 ; Password Authenication Protocol packet
 
 
MaxRx equ 1500
MaxTx equ 1500
 
 
 
 
use32
 
org 0x0
 
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd STARTAPP ; 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"
include "chat.inc" ; Hosts modem chatting routine
 
 
STARTAPP:
; mov eax, 0x3f8
; mov [comport], eax
; mov eax, 4
; mov [comirq], eax
 
; Get the com port & IRQ to use from the kernel stack config option
 
mov eax, 52 ; Stack Interface
mov ebx, 0 ; read configuration word
int 0x40
mov ecx, eax
shr ecx, 16 ; get the port address
mov [comport], ecx
shr eax, 8
and eax, 0x000000FF ; get the irq
mov [comirq], eax
 
 
mov eax, [comport]
add eax, 0x01000000
mov [irqtable], eax
 
 
call enable_port
 
appdsp:
mov eax, welcomep
mov [prompt], eax ; set up prompt to display
mov al, [welcomep_len]
mov [prompt_len], al
 
call draw_window ; at first, draw the window
 
 
apploop:
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
mov ebx, [comirq]
add ebx, 16
cmp eax, ebx
je flush_input ; Dont want serial data yet
jmp apploop
 
red: ; redraw
call draw_window
jmp apploop
 
key: ; key - ignore
mov eax, 2 ; just read it
int 0x40
jmp apploop
 
button: ; button
mov eax, 17 ; get id
int 0x40
 
cmp ah, 1 ; close program ?
jne noclose
 
mov esi, hangupWait
mov edi, hangupSend
mov edx, 1000 ; Allow sendwait 10s
call sendwait
 
call disable_port
 
mov eax, -1 ; close this program
int 0x40
jmp apploop
 
noclose:
cmp ah, 2 ; Dial Button pressed?
jne apploop
 
mov eax, conp
mov [prompt], eax ; set up prompt to display
mov al,[conp_len]
mov [prompt_len], al
call draw_window
 
jmp dialloop ; connect to the host
 
 
; Data received, so get it, and throw it away at this point
flush_input:
mov eax,42
mov ebx, [comirq]
int 0x40
 
mov eax,11 ; This will return 0 most of the time
int 0x40
mov ebx, [comirq]
add ebx, 16
cmp eax, ebx
je flush_input
jmp apploop
 
 
dialloop:
call modem_chat ; Try chatting with the modem
 
cmp eax, 1 ; Did it work? ( = 1)
jne appdsp
 
; OK, we are now connected.
 
mov eax, pppOnp
mov [prompt], eax ; set up prompt to display
mov al,[pppOnp_len]
mov [prompt_len], al
call draw_window
 
mov eax, 23
mov ebx, 100
int 0x40 ; wait for 1s to display message
 
call PPPStateMachine ; This is the main code
 
jmp appdsp
 
 
 
 
;****************************************************************************
; Function
; PPPStateMachine
;
; Description
; Handles PPP link establishment
;
;****************************************************************************
PPPStateMachine:
; Start the timer
xor eax, eax
call settimer
 
PPPLoop:
 
mov eax, 11 ; check event
int 0x40
cmp eax, 3
jne PPPLred
; button pressed
mov eax, 17 ; get id
int 0x40
 
 
mov eax, hangp
mov [prompt], eax ; set up prompt to display
mov al,[hangp_len]
mov [prompt_len], al
call draw_window
 
mov esi, hangupWait
mov edi, hangupSend
mov edx, 1000 ; Allow sendwait 10s
call sendwait
 
call disable_port
mov eax, -1 ; close this program
int 0x40
jmp PPPLoop
 
PPPLred:
cmp eax, 1 ; redraw request ?
jne PPPLoop0
 
call draw_window
jmp PPPLoop
 
PPPLoop0:
mov ebx, [comirq]
add ebx, 16
cmp eax, ebx
jne ppp_002 ; check for tx to send
 
 
; we have data in the rx buffer, get it
 
mov eax, 42
mov ebx, [comirq] ; ecx will return 0 =data read, 1 =no data
int 0x40 ; or 2 =not irq owner
 
inc dword [rxbytes]
 
cmp bl, 0x7E
jne ppp_001a
 
mov eax, [rx_ptr]
cmp eax, 0
jz ppp_001
mov eax, [checksum1]
cmp eax, 0xf0b8
jne ppp_001
 
 
movzx eax, byte [rx_str + 3]
mov ah, [rx_str + 2]
mov [packet], eax
 
ppp_001:
mov eax, [extended]
and eax, 0x7e
mov [extended], eax
xor eax, eax
mov [rx_ptr], eax
 
mov eax, 0xffff
mov [checksum1], eax
jmp ppp_003
 
ppp_001a:
cmp bl, 0x7D
jne ppp_001b
 
mov eax, [extended]
or eax, 0x01
mov [extended], eax
jmp ppp_003
 
ppp_001b:
mov eax, [extended]
test eax, 0x01
jz ppp_001c
 
xor bl, 0x20
and eax, 0xFE
mov [extended], eax
 
ppp_001c:
mov edx, [rx_ptr]
cmp edx, 0
jnz ppp_001d
cmp bl, 0xff
je ppp_001d
 
mov [rx_str + edx], byte 0xff
inc edx
 
ppp_001d:
cmp edx, 1
jnz ppp_001e
cmp bl, 0x03
je ppp_001e
 
mov [rx_str + edx], byte 0x03
inc edx
 
ppp_001e:
cmp edx, 2
jnz ppp_001f
test bl, 0x01
jz ppp_001f
 
mov [rx_str + edx], byte 0
inc edx
 
ppp_001f:
mov [rx_str + edx], bl
inc edx
mov [rx_ptr], edx
 
cmp edx, MaxRx
jle ppp_001g
mov edx, MaxRx
mov [rx_ptr], edx
 
ppp_001g:
; do checksum calc
mov eax, [checksum1]
xor bh, bh
xor ax, bx
call calc
mov ebx, [checksum1]
and ebx, 0xffff
shr ebx, 8
xor eax, ebx
mov [checksum1], eax
jmp ppp_003
 
ppp_002:
mov eax, [tx_end]
cmp eax, 0
jz ppp_003
 
mov ebx, [tx_ptr]
mov cl, [tx_str + ebx]
 
cmp ebx, eax
jne ppp_002a
mov [tx_end], dword 0
mov cl, '~'
jmp ppp_002d
 
ppp_002a:
mov eax, [extended]
and eax, 0x02
jz ppp_002b
 
xor cl, 0x20
mov eax, [extended]
and eax, 0xFD
mov [extended], eax
inc [tx_ptr]
jmp ppp_002d
 
ppp_002b:
cmp cl, 0x20
jl ppp_002b1
cmp cl, 0x7d
je ppp_002b1
cmp cl, 0x7e
je ppp_002b1
jmp ppp_002c
 
ppp_002b1:
mov eax, [extended]
or eax, 0x02
mov [extended], eax
mov cl, 0x7d
jmp ppp_002d
 
ppp_002c:
mov eax, [tx_ptr]
cmp eax, 0
jnz ppp_002c1
mov cl, '~'
 
ppp_002c1:
inc [tx_ptr]
 
ppp_002d:
; Test for tx ready.
 
push ecx
 
wait_txd2:
mov eax,43
mov ecx, [comport]
add ecx, 0x80000000 + 5
int 0x40
and bl, 0x40
cmp bl, 0
jz wait_txd2 ; loop until free
 
pop ebx
 
 
; send the character
 
inc dword [txbytes]
 
mov ecx, [comport]
mov eax, 43
int 0x40
 
ppp_003:
mov eax, [packet]
cmp eax, LCP
jne ppp_004
 
mov al, [rx_str + 4]
cmp al, REQ
jne ppp_003b
 
; Debugging output to debug board
pusha
mov esi, RX_LCP_REQ
call debug_output
popa
 
mov eax, [state]
and eax, 0xfd
mov [state], eax
 
mov ebx, 0xc6
push eax
call TestOptions
pop eax
cmp edx, 0
jz ppp_003g
 
cmp edx, 1
jle ppp_003h
 
mov edx, PPP_ACK
cmp eax, 3
jge ppp_003i
 
or eax, 0x02
mov [state], eax
jmp ppp_003i
 
ppp_003h:
mov bl, 0xc0
mov [rx_str + 10], bl
mov edx, PPP_NAK
jmp ppp_003i
 
ppp_003g:
mov edx, REJ
 
ppp_003i:
 
mov ebx, LCP
mov ecx, edx
movzx edx, byte [rx_str + 5]
mov esi, rx_str + 7
call MakePacket
 
mov eax, 0
call settimer
jmp ppp_003a
 
ppp_003b:
cmp al, PPP_ACK
jne ppp_003c
 
; Debugging output to debug board
pusha
mov esi, RX_LCP_ACK
call debug_output
popa
 
mov eax, [number]
cmp al, [rx_str+5]
jne ppp_003a
 
mov eax, [state]
cmp eax, 3
jge ppp_003a
or eax, 0x01
mov [state], eax
jmp ppp_003a
 
ppp_003c:
cmp al, PPP_NAK
jne ppp_003d
 
; Debugging output to debug board
pusha
mov esi, RX_LCP_NAK
call debug_output
popa
 
mov eax, [state]
and eax, 0xfe
mov [state], eax
jmp ppp_003a
 
ppp_003d:
cmp al, REJ
jne ppp_003e
 
; Debugging output to debug board
pusha
mov esi, RX_LCP_REJ
call debug_output
popa
 
mov eax, [state]
and eax, 0xfe
mov [state], eax
jmp ppp_003a
 
ppp_003e:
cmp al, TERM
jne ppp_003j
jmp ppp_003a
 
ppp_003j:
cmp al, LCP_ECHO_REQ
jne ppp_003a
 
; Debugging output to debug board
pusha
mov esi, RX_LCP_ECHO_REQ
call debug_output
popa
 
mov al, 0
mov [rx_str+8],al
mov [rx_str+9],al
mov [rx_str+10],al
mov [rx_str+11],al
 
mov ebx, LCP
mov ecx, LCP_ECHO_REP
movzx edx, byte [rx_str + 5]
mov esi, rx_str + 7
call MakePacket
 
ppp_003a:
mov eax, [state]
cmp eax, 3
jne ppp_013
 
mov eax, 4
mov [state], eax
 
jmp ppp_013
 
 
ppp_004:
cmp eax, PAP
jne ppp_005
 
mov al, [rx_str + 4]
cmp al, PPP_ACK
jne ppp_013
 
; Debugging output to debug board
pusha
mov esi, RX_PAP_ACK
call debug_output
popa
 
mov eax, 5
mov [state],eax
jmp ppp_013
 
ppp_005:
cmp eax, IPCP
jne ppp_006
 
mov al, [rx_str + 4]
cmp al, REQ
jne ppp_005a
 
; Debugging output to debug board
pusha
mov esi, RX_IPCP_REQ
call debug_output
popa
 
mov ebx, 0x04
call TestOptions
cmp edx, 0
jz ppp_005b
mov ecx, PPP_ACK
mov eax, 6
mov [state], eax
jmp ppp_005c
ppp_005b:
mov ecx, REJ
 
ppp_005c:
mov ebx, IPCP
movzx edx, byte [rx_str + 5]
mov esi, rx_str + 7
call MakePacket
jmp ppp_013
 
ppp_005a:
cmp al, PPP_ACK
jne ppp_005d
 
; Debugging output to debug board
pusha
mov esi, RX_IPCP_ACK
call debug_output
popa
 
mov al, [rx_str + 5]
mov ecx, [number]
cmp al, cl
jne ppp_013
 
mov eax, 7
mov [state], eax
mov eax, 5800
call settimer
 
mov eax, IPOnp
mov [prompt], eax ; set up prompt to display
mov al,[IPOnp_len]
mov [prompt_len], al
call draw_window
 
jmp ppp_013
 
ppp_005d:
cmp al, PPP_NAK
jne ppp_005e
 
; Debugging output to debug board
pusha
mov esi, RX_IPCP_NAK
call debug_output
popa
 
mov al, [rx_str + 10]
mov [addr1], al
mov al, [rx_str + 11]
mov [addr2], al
mov al, [rx_str + 12]
mov [addr3], al
mov al, [rx_str + 13]
mov [addr4], al
 
pusha
call draw_window
 
mov eax,52
mov ebx,3
mov cl, [addr4]
shl ecx, 8
mov cl, [addr3]
shl ecx, 8
mov cl, [addr2]
shl ecx, 8
mov cl, [addr1]
int 0x40 ; Set the stacks IP address
 
popa
 
mov ebx, IPCP ;; added 28/4/03
mov ecx, REQ
movzx edx, byte [rx_str + 5]
mov esi, rx_str + 7
call MakePacket
jmp ppp_013
 
ppp_005e:
cmp al, REJ
jne ppp_005f
jmp ppp_013
 
ppp_005f:
cmp al, TERM
jne ppp_013
jmp ppp_013
 
ppp_006:
cmp eax, IP
jne ppp_007
 
 
;;
;;
;;
;; This is where we will pass the IP packet up to the stack
;;
;;
;;
mov eax, 52
mov ebx, 6
mov edx, 1500 ; this should be exact amount
mov esi, rx_str + 4
int 0x40
 
; Debugging output to debug board
pusha
mov esi, RX_IP
call debug_output
popa
 
jmp ppp_013
 
ppp_007:
cmp eax, CCP
jne ppp_008
 
mov al, [rx_str + 4]
cmp al, REQ
jne ppp_013
 
; Debugging output to debug board
pusha
mov esi, RX_CCP_REQ
call debug_output
popa
 
mov ebx, 0x04
call TestOptions
cmp edx, 0
jz ppp_007b
mov ecx, PPP_ACK
jmp ppp_007c
ppp_007b:
mov ecx, REJ
 
ppp_007c:
mov ebx, CCP
movzx edx, byte [rx_str + 5]
mov esi, rx_str + 7
call MakePacket
 
jmp ppp_013
 
ppp_008:
cmp eax, 0
jz ppp_009
 
jmp ppp_013
 
ppp_009:
mov eax, [tx_end]
cmp eax, 0
jnz ppp_010
call gettimer
cmp eax, 100
jle ppp_010
 
mov eax, [state]
cmp eax, 0
je ppp_009a
cmp eax, 2
jne ppp_010
 
ppp_009a:
 
; Debugging output to debug board
pusha
mov esi, TX_LCP_REQ
call debug_output
popa
 
inc [number]
mov eax, 0
call settimer
 
mov ebx, LCP
mov ecx, REQ
mov edx, [number]
mov esi, LCPREQStr
call MakePacket
 
jmp ppp_013
 
ppp_010:
mov eax, [tx_end]
cmp eax, 0
jnz ppp_011
call gettimer
cmp eax, 100
jle ppp_011
mov eax, [state]
cmp eax, 4
jne ppp_011
mov eax, 0
call settimer
inc [number]
 
; Debugging output to debug board
pusha
mov esi, TX_PAP_REQ
call debug_output
popa
 
mov ebx, PAP
mov ecx, REQ
mov edx, [number]
mov esi, PAPREQStr
call MakePacket
 
jmp ppp_013
 
ppp_011:
mov eax, [tx_end]
cmp eax, 0
jnz ppp_012
call gettimer
cmp eax, 100
jle ppp_012
mov eax, [state]
cmp eax, 6
jne ppp_012
inc [number]
mov eax, 0
call settimer
 
; Debugging output to debug board
pusha
mov esi, TX_IPCP_REQ
call debug_output
popa
 
mov ebx, IPCP
mov ecx, REQ
mov edx, [number]
mov esi, IPCPREQStr
call MakePacket
 
jmp ppp_013
 
ppp_012:
mov eax, [tx_end]
cmp eax, 0
jnz ppp_013
mov eax, [state]
cmp eax, 7
jne ppp_013
 
; 10ms Delay suggested by Ville
mov eax,23 ; over here
mov ebx,1
int 0x40
 
 
 
call gettimer
cmp eax, 200
jle ppp_012a
 
; every 2s, when things are quiet, redraw window
call draw_window_limited
 
mov eax, 0
call settimer
 
ppp_012a:
 
mov eax, 52
mov ebx, 8
mov esi, ip_buff
int 0x40
 
cmp eax, 0
je ppp_013
 
call MakeIPPacket
 
; Debugging output to debug board
pusha
mov esi, TX_IP
call debug_output
popa
 
ppp_013:
mov eax, [packet]
cmp eax, 0
jz PPPLoop
 
mov eax, 0
mov [packet], eax
 
mov edi, rx_str
mov ecx, MaxRx + 1
rep stosb
jmp PPPLoop
 
 
 
;****************************************************************************
; Function
; calc
;
; Description
; Adds a character to the CRC checksum
; byte in lsb of eax
;
;
;****************************************************************************
calc:
and eax, 0xFF
push ecx
mov ecx, 8
calc_001:
test al, 0x01
jz calc_002
shr eax, 1
xor eax, 0x8408
and eax, 0xffff
jmp calc_003
calc_002:
shr eax, 1
calc_003:
loop calc_001
pop ecx
ret
 
 
;****************************************************************************
; Function
; add2tx
;
; Description
; Adds a character into the tx buffer
; byte in low byte of eax
;
;
;****************************************************************************
add2tx:
pusha
mov esi, tx_str
add esi, [tx_ptr]
inc [tx_ptr]
mov [esi], al ; Save byte in buffer
mov ecx, [checksum2]
and eax, 0xff
xor eax, ecx
call calc
shr ecx, 8
and ecx, 0xff
xor eax, ecx
mov [checksum2], eax
popa
ret
 
 
 
;****************************************************************************
; Function
; MakeIPPacket
;
; Description
; Creates a PPP packet for transmission to the host from the
; IP packet extracted from the stack
;
; IP data is in ip_buff
;
;****************************************************************************
MakeIPPacket:
mov [tx_ptr], dword 1
mov edi, tx_str
mov [edi], byte ' '
mov eax, 0xffff
mov [checksum2], eax
mov al, 0xff
call add2tx
mov al, 3
call add2tx
mov al, IP / 256
call add2tx
mov al, IP
call add2tx
 
movzx ecx, byte [ip_buff + 3]
mov ch, byte [ip_buff + 2]
 
mov esi, ip_buff
 
mip001:
mov al, byte [esi]
call add2tx
inc esi
loop mip001
 
mov eax, [checksum2]
not eax
call add2tx
shr eax, 8
call add2tx
 
mov eax, [tx_ptr]
mov [tx_end], eax
xor eax, eax
mov [tx_ptr], eax
ret
 
 
;****************************************************************************
; Function
; MakePacket
;
; Description
; Creates a PPP packet for transmission to the host
;
; Packet type in ebx
; Code is in ecx
; num is in edx
; str is pointed to by esi
;
;****************************************************************************
MakePacket:
mov [tx_ptr], dword 1
mov edi, tx_str
mov [edi], byte ' '
mov eax, 0xffff
mov [checksum2], eax
mov al, 0xff
call add2tx
mov al, 3
call add2tx
mov al, bh ; packet/256
call add2tx
mov al, bl ; packet&255
call add2tx
 
cmp ebx, IP ; is packet type IP?
jne mp_001 ; No - its a lower layer packet
 
; Do IP packet assembly
 
jmp mp_002
 
mp_001:
; Do PPP layer packet assembly
mov al, cl
call add2tx
mov al, dl
call add2tx
mov al, 0
call add2tx
 
movzx ecx, byte [esi] ; length = *str - 3
sub ecx, 3
 
mp_002: ; Now copy the data acros
mov al, byte [esi]
call add2tx
inc esi
loop mp_002
 
mov eax, [checksum2]
not eax
call add2tx
shr eax, 8
call add2tx
 
mov eax, [tx_ptr]
mov [tx_end], eax
xor eax, eax
mov [tx_ptr], eax
ret
 
 
;****************************************************************************
; Function
; TestOptions
;
; Description
; Test a PPP packets options fields for valid entries
;
; option ebx
;
; Returns result in edx, but may also modify rx_str
;
;****************************************************************************
TestOptions:
mov esi, 8 ; ptr1
mov edi, 8 ; ptr2
mov edx, 3 ; edx is the return value
movzx ecx, byte [rx_str + 7]
add ecx, 4 ; ecx is size
cmp ecx, MaxRx
jle to_001
mov ecx, MaxRx
to_001:
cmp esi, ecx
jge to_002
mov al, byte [esi + rx_str]
cmp al, 3
jne to_001a
mov al, byte [esi + rx_str + 2]
cmp al, 0x80
je to_001a
; bug fix for chap authenticate reject below
mov al, byte [esi + rx_str + 2]
cmp al, 0xc2
jne to_001a
and edx, 0xfd
to_001a:
push ecx
mov cl, [esi + rx_str]
dec cl
mov eax, 1
shl eax, cl
and eax, ebx
and eax, 0xffff
pop ecx
cmp eax, 0
jnz to_001b
xor edx,edx
to_001b:
movzx eax, byte [esi+rx_str+1]
add esi, eax
jmp to_001
to_002:
; if (!(pass&2))...
test edx, 2
jnz to_exit
test edx, 1
jz to_002a
mov ebx, 0xFFFB
to_002a:
mov esi, 8
to_002b: ; for loop
cmp esi, ecx
jge to_003
 
push ecx
mov cl, [esi + rx_str]
dec cl
mov eax, 1
shl eax, cl
and eax, ebx
and eax, 0xffff
pop ecx
cmp eax, 0
jnz to_002c
movzx edx, byte [esi+rx_str+1]
to_002d:
cmp esi, ecx
jge to_002b
cmp edx, 0
jz to_002b
mov al, [esi + rx_str]
mov [edi + rx_str], al
inc esi
inc edi
dec edx
jmp to_002d
to_002c:
movzx eax, byte [esi+rx_str+1]
add esi, eax
jmp to_002b ; end of for loop
to_003:
mov eax, edi
sub al, 4
mov [rx_str+7], al
xor edx, edx
cmp ebx, 0xfffb
jne to_exit
inc edx
to_exit:
; Return value in EDX
ret
 
 
 
;***************************************************************************
; Function
; disable_port
;
; Description;
; Releases this applications use of the com port
;
;***************************************************************************
disable_port:
if DEBUG_PORT2_OUTPUT = TRUE
mov eax, 46 ; free port area
mov ebx, 1
 
mov ecx, 0x2f8
and ecx, 0xFF0
mov edx, ecx
or edx, 0x00F
int 0x40
end if
 
mov eax, 45 ; free irq 4
mov ebx, 1
mov ecx, [comirq]
int 0x40
 
mov eax, 46 ; free port area
mov ebx, 1
 
mov ecx, [comport]
and ecx, 0xFF0
mov edx, ecx
or edx, 0x00F
int 0x40
ret
 
 
 
;***************************************************************************
; Function
; enable_port
;
; Description;
; Takes control of the com port, defining the IRQ table and initialising
; the uart chip.
;
;***************************************************************************
enable_port:
pusha
if DEBUG_PORT2_OUTPUT = TRUE
mov eax, 46
mov ebx, 0
mov ecx, 0x2f8
and ecx, 0xFF0
mov edx, ecx
or edx, 0x00F
int 0x40 ; reseve port memory to this process
 
mov eax, 45 ; reserve irq 3
mov ebx, 0
mov ecx, 3
int 0x40
 
 
mov ecx, 0x2f8 ; data format register
add ecx, 3
mov bl, 0x80 ; enable access to divisor latch
mov eax, 43 ; send data to device - com port setup
int 0x40
 
mov ecx, 0x2f8 ; interrupt enable register
inc ecx
mov bl, 0 ; No interruts enabled
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, 0x2f8 ; Divisor latch LSB
mov bl, BAUDRATE ; set baud rate
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, 0x2f8 ; Data format register
add ecx, 3
mov bl, 3 ; 8 data bits
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, 0x2f8 ; Modem control register
add ecx, 4 ; ** bl must be 0x0b for modem to dial!
mov bl, 0x0b ; 0x08 -> out2 enabled. No handshaking.
; 0xb -> out2 enabled, RTS/DTR enabled
mov eax, 43 ; send data to device (modem)
int 0x40
 
; mov ecx, 0x2f8 ; interrupt enable register
; inc ecx
; mov bl, 1 ; rx data interrupt enabled, othrs not
; mov eax, 43 ; send data to device (modem)
; int 0x40
 
end if
 
mov eax, 46
mov ebx, 0
mov ecx, [comport]
and ecx, 0xFF0
mov edx, ecx
or edx, 0x00F
int 0x40 ; reseve port memory to this process
 
mov eax, 45 ; reserve irq 4
mov ebx, 0
mov ecx, [comirq]
int 0x40
 
mov eax, 44 ; setup irq table
mov ebx, irqtable
mov ecx, [comirq]
int 0x40
 
mov ecx, [comport] ; data format register
add ecx, 3
mov bl, 0x80 ; enable access to divisor latch
mov eax, 43 ; send data to device - com port setup
int 0x40
 
mov ecx, [comport] ; interrupt enable register
inc ecx
mov bl, 0 ; No interruts enabled
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, [comport] ; Divisor latch LSB
mov bl, BAUDRATE ; set baud rate
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, [comport] ; Data format register
add ecx, 3
mov bl, 3 ; 8 data bits
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, [comport] ; Modem control register
add ecx, 4 ; ** bl must be 0x0b for modem to dial!
mov bl, 0x0b ; 0x08 -> out2 enabled. No handshaking.
; 0xb -> out2 enabled, RTS/DTR enabled
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, [comport] ; interrupt enable register
inc ecx
mov bl, 1 ; rx data interrupt enabled, othrs not
mov eax, 43 ; send data to device (modem)
int 0x40
 
mov ecx, [comirq]
add ecx, 16
mov ebx, 1
shl ebx, cl
add ebx, 111b
mov eax,40 ; enable irq 4 data
int 0x40
 
popa
ret
 
 
 
;**************************************************************************
; Function
; draw_window
;
; Description;
; Normal window definition and text layout for application
;**************************************************************************
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+250 ; [x start] *65536 + [x size]
mov ecx, 100*65536+150 ; [y start] *65536 + [y size]
mov edx,0x03224466 ; color of work area RRGGBB
mov esi,0x00334455 ; color of grab bar RRGGBB
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
; DIAL BUTTON
mov eax, 8 ; function 8 : define and draw button
mov ebx, (50)*65536+40 ; [x start] *65536 + [x size]
mov ecx, 130*65536+12 ; [y start] *65536 + [y size]
mov edx, 2 ; button id
mov esi, 0x5599cc ; button color RRGGBB
int 0x40
 
mov ebx, 55*65536+133 ; Draw button text
mov ecx, 0x00FFFFFF
mov edx, button1_text
xor eax, eax
mov al, [button1_text_len]
mov esi, eax
mov eax, 4
int 0x40
; DISCONNECT BUTTON
mov eax, 8 ; function 8 : define and draw button
mov ebx, (150)*65536+65 ; [x start] *65536 + [x size]
mov ecx, 130*65536+12 ; [y start] *65536 + [y size]
mov edx, 3 ; button id
mov esi, 0x5599cc ; button color RRGGBB
int 0x40
 
mov ebx, 155*65536+133 ; Draw button text
mov ecx, 0x00FFFFFF
mov edx, button3_text
xor eax, eax
mov al, [button3_text_len]
mov esi, eax
mov eax, 4
int 0x40
 
mov ebx, 5*65536+40 ; draw info text with function 4
mov ecx, 0x00FFFFFF
mov edx, [prompt]
xor eax, eax
mov al, [prompt_len]
mov esi, eax
mov eax, 4
int 0x40
 
; Draw IP address
mov edx, 10*65536+60
mov esi, 0x00FFFFFF
mov ebx, 0x00030000
movzx ecx, byte [addr1]
mov eax, 47
int 0x40
mov edx, 31*65536+60
mov esi, 0x00FFFFFF
mov ebx, 0x00030000
movzx ecx, byte [addr2]
mov eax, 47
int 0x40
mov edx, 52*65536+60
mov esi, 0x00FFFFFF
mov ebx, 0x00030000
movzx ecx, byte [addr3]
mov eax, 47
int 0x40
mov edx, 73*65536+60
mov esi, 0x00FFFFFF
mov ebx, 0x00030000
movzx ecx, byte [addr4]
mov eax, 47
int 0x40
 
; Status byte
mov edx, 100*65536+60
mov esi, 0x00FFFFFF
mov ebx, 0x00010000
movzx ecx, byte [state]
mov eax, 47
int 0x40
 
; bytes sent / received
mov eax, 4 ; function 4 : write text to window
mov ebx, 10*65536+80 ; [x start] *65536 + [y start]
mov ecx, 0x00ffffff ; color of text RRGGBB
mov edx, txmsg ; pointer to text beginning
mov esi, txmsglen-txmsg ; text length
int 0x40
 
mov eax, 4 ; function 4 : write text to window
mov ebx, 10*65536+100 ; [x start] *65536 + [y start]
mov ecx, 0x00ffffff ; color of text RRGGBB
mov edx, rxmsg ; pointer to text beginning
mov esi, rxmsglen-rxmsg ; text length
int 0x40
 
call draw_window_limited
 
mov eax, 12 ; end of redraw
mov ebx, 2
int 0x40
 
ret
 
 
 
draw_window_limited:
mov eax,13
mov ebx,80*65536+10*6
mov ecx,80*65536+10
mov edx,0x03224466
int 0x40
mov eax,13
mov ebx,80*65536+10*6
mov ecx,100*65536+10
mov edx,0x03224466
int 0x40
 
mov ebx, 0x000A0000
mov ecx, [txbytes]
mov esi, 0x00ffffff ; color of text RRGGBB
mov eax, 47 ; function 47 : write number to window
mov edx, 80*65536+80 ; [x start] *65536 + [y start]
int 0x40
 
mov ebx, 0x000A0000
mov ecx, [rxbytes]
mov esi, 0x00ffffff ; color of text RRGGBB
mov eax, 47 ; function 47 : write number to window
mov edx, 80*65536+100 ; [x start] *65536 + [y start]
int 0x40
ret
 
 
;****************************************************************************
; Function
; settimer
;
; Description
; sets the general purpose timer to a given value in eax
; All times are in 1/100s
;
;
;****************************************************************************
settimer:
push eax
mov eax, 26
mov ebx, 9
int 0x40 ; get 100th second counter
pop ebx
sub eax, ebx ; This could have some funny side effecs if PPP
; called within ebx seconds of startup
mov [timerValue], eax
ret
 
 
;****************************************************************************
; Function
; gettimer
;
; Description
; gets the general purpose timer count in eax
; All times are in 1/100s
;
;
;****************************************************************************
gettimer:
mov eax, 26
mov ebx, 9
int 0x40 ; get 100th second counter
 
sub eax, [timerValue]
ret
 
 
 
 
;****************************************************************************
; Function
; sendwait
;
; Description
; Sends a command string to the modem, then waits for a defined rsp
;
; esi points to string to wait for
; edi points to string to send
; edx holds wait time, in ms
;
; Returns 1 if OK or 0 if timeout occurred
;
;****************************************************************************
sendwait:
mov [sendwaitTime], edx
 
; Shrirang 2/5/03
mov byte [abortcnt], 0 ; reset the abort counter
;--!
 
; Start the timer
xor eax, eax
call settimer
 
; Check for incoming data
 
xor edx, edx
xor eax, eax
 
sw_001:
push eax
push edx
 
; Has connection timer expired?
call gettimer
cmp eax, [sendwaitTime]
jl sw_000
 
pop edx
pop eax
 
xor eax, eax
 
jmp sw_exit ; Exit indicating an error ( timeout )
 
sw_000:
; any data from modem?
 
mov eax,11 ; This will return 0 most of the time
int 0x40
mov ecx, eax
pop edx
pop eax
 
 
cmp ecx, 1 ; redraw request ?
je red1
cmp ecx, 3 ; button in buffer ?
je button1
mov ebx, [comirq]
add ebx, 16
cmp ecx,ebx
jne sw_002
jmp sw_000a
 
red1:
pusha
call draw_window
popa
push eax
push edx
 
jmp sw_000
 
button1:
mov eax, 0
jmp sw_exit
 
sw_000a:
; there was data, so get it
 
push edx
push eax
mov eax,42
mov ebx, [comirq]
int 0x40
pop eax
pop edx
 
 
; Shrirang 2/5/03
; Now that the expected response is not got we check if we
; got the abort part, before we reset the fsm
 
cmp bl, 0x0d ; AT commands normally start and end with \r\n
je checkabort
 
cmp bl, 0x0a
je checkabort
 
push eax
xor eax, eax
mov al, [abortcnt]
mov byte [abortres+eax], bl ; update abort response
inc byte [abortcnt]
pop eax
 
jmp noabort
 
 
checkabort :
 
cmp byte [abortcnt], 2 ; if we got valid abort this cannot happen!
jbe noabortflush
 
push eax
push esi
push edi
push ecx
 
mov esi, abortres
mov edi, aborts
xor ecx, ecx
mov cl, byte [abortcnt]
call scanaborts ; scan 'em
 
pop ecx
pop edi
pop esi
 
and eax, eax
jz noabortdec
 
pop eax
xor eax, eax
jmp sw_exit
 
noabortdec:
 
pop eax
 
noabortflush:
 
mov byte [abortcnt], 0
 
noabort:
 
;--!
 
cmp [esi+edx], bl
je sw_003
 
 
xor edx, edx
 
; Added 28/4/03
cmp [esi+edx], bl
je sw_003
 
jmp sw_001
 
sw_003: ; They are the same
inc edx
cmp [esi+edx], byte 0
jne sw_001
 
 
xor eax, eax
inc eax
jmp sw_exit
 
sw_002:
; Test for data to send to modem
cmp [ edi + eax ], byte 0
je sw_001
 
; Is it a '|' character?
cmp [ edi + eax ], byte '|'
jne sw_004
 
push eax
call gettimer
cmp eax, 100
pop eax
jl sw_001
 
; restart the timer
push eax
xor eax, eax
call settimer
pop eax
 
; Move to next character
inc eax
jmp sw_001
 
 
sw_004:
push edx
push eax
 
; restart the timer
xor eax, eax
call settimer
 
; Test for tx ready.
; OR, wait then send
push edi
mov eax, 5
mov ebx, 1
int 0x40 ; 10ms delay
pop edi
 
; send the character
pop eax
mov bl, [edi + eax]
 
mov ecx, [comport]
inc eax
push eax
mov eax, 43
int 0x40
 
pop eax
pop edx
 
cmp [ edi + eax ], byte 0
jne sw_001
 
cmp [ esi + edx ], byte 0
jne sw_001
 
xor eax, eax
inc eax
 
sw_exit:
; return success (1) or failure (0) in eax
ret
 
 
 
 
if DEBUG_OUTPUT = TRUE
 
;****************************************************************************
; Function
; debug_output
;
; Description
; prints a description of the PPP protocol's data exchanges to the
; debug board
;
; esi holds ptr to msg to display
;
; Nothing preserved; I'm assuming a pusha/popa is done before calling
;
;****************************************************************************
debug_output:
cmp esi, RX_IP
jne do_001
 
call debug_print_string
 
call debug_print_rx_ip
 
mov esi, IP_DATA1
call debug_print_string
mov esi, CRLF
call debug_print_string
mov esi, IP_DATA2
call debug_print_string
ret
 
do_001:
cmp esi, TX_IP
jne do_002
 
call debug_print_string
 
call debug_print_tx_ip
 
mov esi, IP_DATA1
call debug_print_string
mov esi, CRLF
call debug_print_string
mov esi, IP_DATA2
call debug_print_string
ret
 
do_002:
; Print PPP protocol information
if DEBUG_PPP_OUTPUT = TRUE
call debug_print_string
mov esi, CRLF
call debug_print_string
end if
ret
 
 
 
txCom2:
push ecx
 
wait_txd2t:
mov eax,43
mov ecx,0x80000000 + 0x2f8 + 5
int 0x40
and bl, 0x40
cmp bl, 0
jz wait_txd2t ; loop until free
 
pop ebx
 
 
; send the character
 
mov ecx, 0x2f8
mov eax, 43
int 0x40
ret
 
 
;****************************************************************************
; 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:
if DEBUG_PORT2_OUTPUT = TRUE
pusha
call txCom2
popa
end if
mov eax,63
mov ebx, 1
push esi
int 0x40
pop esi
inc esi
jmp debug_print_string
 
 
; 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_DATA1 db 'TCP From: xxxxxxxx To: xxxxxxxx SrcP: xxxx DestP: xxxx',0
IP_DATA2 db 'Seq: xxxxxxxx Ack: xxxxxxxx Flags: xx dataLen: xxxx',13,10,0
 
 
 
debug_print_rx_ip:
mov esi, rx_str + 4 ; The ip buffer address start
 
mov edi, IP_DATA1
 
cmp [esi+9], byte 1
jne rnICMP
mov eax,'ICMP'
jmp drp
rnICMP:
cmp [esi+9], byte 6
jne rnTCP
mov eax,'TCP '
jmp drp
rnTCP:
cmp [esi+9], byte 17
jne rnUDP
mov eax,'UDP '
jmp drp
rnUDP:
 
drp:
mov [edi], eax
 
call fillData
 
ret
 
 
debug_print_tx_ip:
mov esi, ip_buff ; The ip buffer address start
 
mov edi, IP_DATA1
 
cmp [esi+9], byte 1
jne tnICMP
mov eax,'ICMP'
jmp dtp
tnICMP:
cmp [esi+9], byte 6
jne tnTCP
mov eax,'TCP '
jmp dtp
tnTCP:
cmp [esi+9], byte 17
jne tnUDP
mov eax,'UDP '
jmp dtp
tnUDP:
 
dtp:
mov [edi], eax
 
call fillData
 
ret
 
 
fillData:
; Display from IP
mov cl, [esi+12]
mov edx, 11
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+13]
mov edx, 13
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+14]
mov edx, 15
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+15]
mov edx, 17
call wbyte ; byte in cl, dest in edi+edx
 
; Display to IP
mov cl, [esi+16]
mov edx, 24
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+17]
mov edx, 26
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+18]
mov edx, 28
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+19]
mov edx, 30
call wbyte ; byte in cl, dest in edi+edx
 
; Only display extra data for TCP
cmp [esi+9], byte 6 ; TCP?
je nTCP
 
; display source port
mov [edi+32], byte 0
mov edi, IP_DATA2
mov [edi], byte 0
ret
 
nTCP:
mov [edi+32], byte ' '
 
mov cl, [esi+20]
mov edx, 39
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+21]
mov edx, 41
call wbyte ; byte in cl, dest in edi+edx
 
mov cl, [esi+22]
mov edx, 51
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+23]
mov edx, 53
call wbyte ; byte in cl, dest in edi+edx
 
 
mov edi, IP_DATA2
mov [edi], byte 'S'
 
mov cl, [esi+24]
mov edx, 5
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+25]
mov edx, 7
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+26]
mov edx, 9
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+27]
mov edx, 11
call wbyte ; byte in cl, dest in edi+edx
 
mov cl, [esi+28]
mov edx, 19
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+29]
mov edx, 21
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+30]
mov edx, 23
call wbyte ; byte in cl, dest in edi+edx
mov cl, [esi+31]
mov edx, 25
call wbyte ; byte in cl, dest in edi+edx
 
mov cl, [esi+33]
and cl, 0x3F
mov edx, 35
call wbyte ; byte in cl, dest in edi+edx
 
; Display the size of the received packet
mov dh, [esi + 2]
mov dl, [esi + 3]
sub dx, 40
mov cl, dh
mov edx, 48
call wbyte ; byte in cl, dest in edi+edx
mov dh, [esi + 2]
mov dl, [esi + 3]
sub dx, 40
mov cl, dl
mov edx, 50
call wbyte ; byte in cl, dest in edi+edx
 
 
ret
 
 
wbyte: ; byte in cl, dest in edi+edx, edi unchanged
xor eax, eax
mov al, cl
shr al, 4
mov bl, [eax + hexchars]
mov [edi+edx], bl
inc edx
mov al, cl
and al, 0x0f
mov bl, [eax + hexchars]
mov [edi+edx], bl
ret
 
else
debug_output:
ret
end if
 
; DATA AREA
 
 
; debug msgs
RX_IP db 'R: ',0
TX_IP db 'T: ',0
CRLF db 13,10,0
RX_LCP_REQ db 'RX_LCP_REQ',0
RX_LCP_ACK db 'RX_LCP_ACK',0
RX_LCP_NAK db 'RX_LCP_NAK',0
RX_LCP_REJ db 'RX_LCP_REJ',0
RX_LCP_ECHO_REQ db 'RX_LCP_ECHO_REQ',0
RX_PAP_ACK db 'RX_PAP_ACK',0
RX_IPCP_REQ db 'RX_IPCP_REQ',0
RX_IPCP_ACK db 'RX_IPCP_ACK',0
RX_IPCP_NAK db 'RX_IPCP_NAK ( IP Address assigned )',0
RX_CCP_REQ db 'RX_CCP_REQ',0
TX_LCP_REQ db 'TX_LCP_REQ',0
TX_PAP_REQ db 'TX_PAP_REQ',0
TX_IPCP_REQ db 'TX_IPCP_REQ',0
 
 
; Labels for GUI buttons
button1_text db 'DIAL'
button1_text_len db 4
button3_text db 'DISCONNECT'
button3_text_len db 10
 
comport dd 0
comirq dd 0
 
; Pointer to prompt shown to user
prompt dd 0
prompt_len db 0
 
; Application Title
labelt db 'PPP Dialer'
labellen:
 
txmsg: db 'Tx bytes :'
txmsglen:
rxmsg: db 'Rx bytes :'
rxmsglen:
 
timerValue dd 0
sendwaitTime dd 0
 
 
; Prompts displayed to the user
welcomep db 'Select an option below, see ppp.txt'
welcomep_len db 35
 
dialfp db 'Connect Failed...'
dialfp_len db 17
 
connectedp db 'Connected to Host'
connectedp_len db 17
 
conp db 'Connecting to Host'
conp_len db 18
 
pppOnp db 'PPP Started'
pppOnp_len db 11
 
IPOnp db 'IP Link established'
IPOnp_len db 19
 
discp db 'Disconnected from Host'
discp_len db 22
 
hangp db 'Hanging up Modem......'
hangp_len db 22
 
PPPconSend db 0x7e,0xff,0x7d,0x23,0x08,0x08,0x08,0x08,0
PPPconWait db '~~',0
hangupWait db 'ATZ',0
hangupSend db '|||+++|||',10,13,'ATH',10,13,'|ATZ',10,13,0
 
; Shrirang 2/5/03
 
abortres: times(50) db 0
abortcnt db 0
 
;--!
 
LCPREQStr db 0x0e,0x02,0x06,0x00, 0x0a, 0x00, 0x00, 0x07, 0x02, 0x08, 0x02
PAPREQStr db 14, 4, 'free', 4, 'free'
IPCPREQStr db 10, 3, 6, 0, 0, 0, 0
 
irqtable: dd 0x3f8 + 0x01000000 ; read port 0x3f8, byte
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
checksum1 dd 0
checksum2 dd 0
packet dd 0
state dd 0
extended dd 0
number dd 0
tx_end dd 0
tx_ptr dd 0
rx_ptr dd 0
addr1 db 0
addr2 db 0
addr3 db 0
addr4 db 0
rxbytes dd 0
txbytes dd 0
 
 
; End of application code and data marker
 
I_END:
 
rx_str: rb MaxRx + 1
tx_str: rb MaxTx + 1
ip_buff: rb 1500
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rb/trunk/@RB.ASM
0,0 → 1,422
;
; DESKTOP CONTEXT MENU
; written by Ivan Poddubny
;
; €¢â®à - ˆ¢ ­ ®¤¤ã¡­ë©
; e-mail: ivan-yar@bk.ru
;
; Compile with flat assembler
;
include 'lang.inc'
include 'macros.inc'
 
meos_app_start
code
 
mov [start_info.mode], 16
mov [start_info.params], 0
mov [start_info.workarea], work_area
 
mov eax,40 ; ãáâ ­®¢¨¬ ¬ áªã ᮡë⨩
mov ebx,100000b ; ­ á ¨­â¥à¥áã¥â ⮫쪮 ¬ëèì
int 0x40
 
still: ; £« ¢­ë© 横« ®á­®¢­®£® ¯à®æ¥áá 
 
mov eax,10 ; ¦¤ñ¬ ᮡëâ¨ï
int 0x40
 
cmp eax,6 ; ¬ëèì?
jne still
 
mov eax,37 ; ª ª¨¥ ­ ¦ âë ª¯®¯ª¨?
mov ebx,2
int 0x40
 
cmp eax,2 ; ¥á«¨ ­¥ ¯à ¢ ï, ¢®§¢à â
jne still
 
;---¯®¥å «¨!---
 
; mov eax,37 ; íâ® ¤«ï ®â« ¤ª¨ - ¥á«¨ ¬ëèì ¢ â®çª¥ (0;0), § ªà®¥¬áï
; xor ebx,ebx
; int 0x40
; test eax,eax ; ªãàá®à ¢ â®çª¥ (0;0), â.¥. eax = 0
; je exit
 
 
mov eax,9 ; ¯®«ã稬 ç¨á«® ¯à®æ¥áᮢ ¢ á¨á⥬¥
mov ebx,procinfo
xor ecx,ecx
int 0x40
 
inc eax ; ⥯¥àì ¢ eax ᮤ¥à¦¨âáï ç¨á«® ¯à®æ¥áᮢ + 1
mov [processes],eax
mov ecx,1
 
new_process:
pushad
mov eax,9 ; ¯®«ã稬 ¨­ä®à¬ æ¨î ® ¯à®æ¥áá¥; ­®¬¥à - ¢ ecx
mov ebx,procinfo
int 0x40
mov eax,37 ; ª®®à¤¨­ âë ªãàá®à 
xor ebx,ebx
int 0x40
mov ebx,eax ; eax = cursor_x
shr eax,16 ; ebx = cursor_y
and ebx,0xffff
mov [curx1],eax ; curx1 = cursor_x
mov [cury1],ebx ; cury1 = cursor_y
mov eax,[procinfo.x_start] ; eax = wnd_x_start
mov ebx,[procinfo.y_start] ; ebx = wnd_y_start
 
mov ecx,[procinfo.x_size]
add ecx,eax ; ecx = wnd_x_end
mov edx,[procinfo.y_size]
add edx,ebx ; ecx = wnd_y_end
 
cmp eax,[curx1] ; wnd_x_start > cursor_x => ªãàá®à «¥¢¥¥ ®ª­ 
jg ne_goden
cmp ecx,[curx1] ; wnd_x_end < cursor_x => ªãàá®à ¯à ¢¥¥ ®ª­ 
jl ne_goden
cmp ebx,[cury1] ; wnd_y_start > cursor_y => ªãàá®à ¢ëè¥ ®ª­ 
jg ne_goden
cmp edx,[cury1] ; wnd_y_end < cursor_y => ªãàá®à ­¨¦¥ ®ª­ 
jl ne_goden
 
goden: ; ª«¨ª ¡ë« ¢­ãâਠª ª®£®-â® ®ª­ , ¯®í⮬㠭¨ç¥£® ­¥ ¤¥« ¥¬
popad
jmp still
 
ne_goden: ; ª«¨ª ¡ë« á­ à㦨 à áᬠâਢ ¥¬®£® ®ª­ , ¯®í⮬ã
popad
inc ecx
cmp ecx,[processes]
jl new_process ; «¨¡® ᬮਬ á«¥¤ãî饥 ®ª­®, «¨¡® § ¯ã᪠¥¬ ¬¥­î
 
 
@@: ; ¯®¤®¦¤ñ¬, ¯®ª  ¯®«ì§®¢ â¥«ì ­¥ ®â¯ãá⨫ ¯à ¢ãî ª­®¯ªã ¬ëè¨
mov eax,37
mov ebx,2 ; äã­ªæ¨ï 37-2:
int 0x40 ; ­ ¦ âë «¨ ª­®¯ª¨ ¬ëè¨?
cmp eax,ebx ; ¥á«¨ ®â¯ãá⨫, (eax != 2)
jnz @f ; ¨¤ñ¬ ¢ ­ ç «® £« ¢­®£® 横« 
 
mov eax,5 ; ¨­ ç¥
mov ebx,2 ; ¯®¤®¦¤ñ¬ 2 ¬á
int 0x40
 
jmp @b ; ¨ ¯à®¢¥à¨¬ ¬ëèì ®¯ïâì
@@:
 
; ¥á«¨ 㦥 ¡ë«® ®âªàëâ® ¬¥­î, ­ã¦­® ¯®¤®¦¤ âì, ¯®ª  ®­® § ªà®¥âáï:
@@:
cmp [menu_opened],0
je @f
mov eax,5
mov ebx,3 ; ¦¤ñ¬ 3 ¬á
int 0x40
jmp @b
@@:
 
mov eax,51 ;   ⥯¥àì ¬®¦­® ᬥ«® § ¯ã᪠âì ¯à®æ¥áá (¯®â®ª) ¬¥­î
mov ebx,1 ; ᮧ¤ ñ¬ ¯®â®ª (thread)
mov ecx,start_wnd ; â®çª  ¢å®¤  ¯®â®ª 
mov edx,stack_wnd ; ¢¥à設  áâíª  ¤«ï ¯®â®ª 
int 0x40
 
jmp still
 
 
 
exit_menu: ; ¥á«¨ ¢ë室¨¬ ¨§ ¬¥­î, ­ ¤® § ¯¨á âì ¢ [menu_opened] 0
mov [menu_opened],0
exit: ; á ¬ë ¨¤ñ¬, ª®£¤  ¢ë室¨¬ ¨§ ®á­®¢­®£® ¯à®æ¥áá 
or eax,-1 ; eax = -1
int 0x40
 
 
 
 
; §¤¥áì áâ àâã¥â ¯à®æ¥áá ¬¥­î
start_wnd:
mov [menu_opened],1
call draw_window
 
mov eax,40 ; ãáâ ­®¢¨¬ ¬ áªã ¦¥« ¥¬ëå ᮡë⨩ ¤«ï í⮣® ¯à®æ¥áá 
mov ebx,100101b ; ¬¥­î + ª­®¯ª¨ + ¯¥à¥à¨á®¢ª 
int 0x40
 
still2: ; £« ¢­ë© 横« ¯à®æ¥áá  ¬¥­î
 
mov eax,10 ; ¦¤ñ¬ ᮡëâ¨ï
int 0x40
 
cmp eax,1 ; ¯¥à¥à¨á®¢ª ?
je red
cmp eax,3 ; ª­®¯ª ?
je button
cmp eax,6 ; ¬ëèì?
je mouse
 
jmp still2 ; ¢¥à­ñ¬áï ¢ ­ ç «® £« ¢­®£® 横« 
 
 
; Ž€Ž’—ˆŠ Œ›˜ˆ
mouse: ; ª®£¤  ¯®«ì§®¢ â¥«ì ­ ¦¬ñâ ª­®¯ªã ¬ëè¨, § ªà®¥¬áï
mov eax,37
mov ebx,2 ; ª ª¨¥ ª­®¯ª¨ ­ ¦ âë?
int 0x40
test eax,eax ; ­¨ª ª¨¥? - ⮣¤  ¯à¥ªà á­®! ¢¥à­ñ¬áï ¢ £« ­ë© 横«
jz still2
jmp exit_menu ;   ¥á«¨ ¢áñ-â ª¨ ­ ¦ âë - § ªà®¥¬ ®ª­®
 
 
; ……ˆ‘Ž‚€’œ ŽŠŽ
red:
call draw_window
jmp still2
 
 
; €†€’€ ŠŽŠ€
button:
mov eax,17 ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
int 0x40
 
cmp ah,10 ; áà ¢­¨¢ ¥¬ á 10
jl nofuncbtns ; ¥á«¨ ¬¥­ìè¥ - § ªà뢠¥¬ ¬¥­î
 
add ah,-10 ; ¢ëç⥬ ¨§ ¨¤¥­â¨ä¨ª â®à  ª­®¯ª¨ 10
movzx ebx,ah ; ¯®«ã稫¨ ­®¬¥à ¯à®£à ¬¬ë ¢ ᯨ᪥ ¢ ebx
lea esi, [startapps + ebx*4]
lea edi, [start_info.path]
mov esi, [esi]
cld
@@:
lodsb
stosb
test al, al
jnz @b
mcall 58, start_info
 
; mov eax,5 ; ¯®¤®¦¤ñ¬, ¯®ª  ¯à®£à ¬¬  § ¯ãáâ¨âìáï
; mov ebx,1 ;   â® ¥ñ ®ª­® ­¥ ¡ã¤¥â ®âà¨á®¢ ­® (¡ £ ¢ ï¤à¥???)
; int 0x40 ; à áª®¬¬¥­â¨àã©â¥ í⨠áâப¨, ¥á«¨ ã ¢ á ¯à®¡«¥¬ë
; á ®âà¨á®¢ª®©
 
nofuncbtns: ; § ªà뢠¥¬ ¬¥­î
jmp exit_menu
 
 
 
_BTNS_ = 8 ; ª®«¨ç¥á⢮ ª­®¯®ª ("¯ã­ªâ®¢ ¬¥­î")
 
if lang eq ru
font = 0x00000000
string_length = 20 ; ¤«¨­  áâப¨
wnd_x_size = 133 ; è¨à¨­  ®ª­ 
header_pos = 36 shl 16 + 7
else
font = 0x10000000
string_length = 12 ; ¤«¨­  áâப¨
wnd_x_size = 105 ; è¨à¨­  ®ª­ 
header_pos = 23 shl 16 + 7
end if
 
;*******************************
;******** ˆ‘“…Œ ŽŠŽ ********
;*******************************
 
draw_window:
 
mov eax,12 ; ­ ç¨­ ¥¬ "à¨á®¢ âì"
mov ebx,1
int 0x40
 
mov eax,[curx1] ; ⥪ã騥 ª®®à¤¨­ âë ªãàá®à 
mov [curx],eax ; § ¯¨è¥¬ ¢ ª®®à¤¨­ âë ®ª­ 
mov eax,[cury1]
mov [cury],eax
 
; ⥯¥àì ¡ã¤¥¬ áç¨â âì ª®®à¤¨­ âë ®ª­ , çâ®¡ë ®­® §  ªà © íªà ­  ­¥ ¢ë«¥§«®
mov eax,14 ; ¯®«ã稬 à §¬¥à íªà ­ 
int 0x40
mov ebx,eax
shr eax,16 ; ¢ eax - x_screen
and ebx,0xffff ; ¢ ebx - y_screen
add eax,-wnd_x_size ; eax = [x_screen - è¨à¨­  ®ª­ ]
add ebx,-_BTNS_*15-21 ; ebx = [y_screen - ¢ëá®â  ®ª­ ]
 
cmp eax,[curx]
jg .okx ; ¥á«¨ ®ª­® ᫨誮¬ ¡«¨§ª® ª ¯à ¢®¬ã ªà î,
add [curx],-wnd_x_size ; ᤢ¨­¥¬ ¥£® ¢«¥¢® ­  100
.okx:
 
cmp ebx, [cury]
jg .oky ; ¯® ¢¥à⨪ «¨ â®ç­® â ª¦¥
add [cury], -_BTNS_*15-21
.oky:
 
mov eax, 48 ; ¯®«ãç¨âì á¨á⥬­ë¥ 梥â 
mov ebx, 3
mov ecx, sc ;  ¤à¥á áâàãªâãàë
mov edx, sizeof.system_colors ; ¨ ¥¥ à §¬¥à
int 0x40
 
xor eax, eax ; äã­ªæ¨ï 0 - ᮧ¤ âì ®ª­®
mov ebx, [curx] ; ebx = [ª®®à¤¨­ â  ¯® x] shl 16 + [è¨à¨­ ]
shl ebx, 16
add ebx, wnd_x_size
mov ecx, [cury] ; ecx = [ª®®à¤¨­ â  ¯® y] shl 16 + [¢ëá®â ]
shl ecx, 16
add ecx, _BTNS_*15+21
mov edx, [sc.work] ; 梥â à ¡®ç¥© ®¡« áâ¨
mov esi, [sc.grab] ; 梥⠧ £®«®¢ª 
or esi, 0x81000000
mov edi, [sc.frame] ; 梥â à ¬ª¨
int 0x40
 
mov eax, 4 ; § £®«®¢®ª
mov ebx, header_pos ; [x] shl 16 + [y]
mov ecx, [sc.grab_text]; èà¨äâ ¨ 梥â (á¥àë©)
add ecx, -0x333333
or ecx, 0x10000000
mov edx, header ;  ¤à¥á § £®«®¢ª 
mov esi, header.size ; ¤«¨­  § £®«®¢ª  ("M E N U")
int 0x40
add ecx, 0x333333 ; 梥⠡¥«ë©
add ebx, 1 shl 16 ; ᤢ¨­¥¬ ¢¯à ¢® ­  1
int 0x40
 
mov ebx, 1*65536+wnd_x_size-2 ; ­ ç¨­ ¥¬ ¤¥« âì ª­®¯ª¨
mov ecx, 20*65536+15
mov edx, 10 or 0x40000000 ; ¡¨â 30 ãáâ ­®¢«¥­ => ª­®¯ª  ­¥ à¨áã¥âáï
 
mov edi,_BTNS_ ; ª®«¨ç¥á⢮ ª­®¯®ª (áçñâ稪)
 
newbtn: ; ­ ç «® 横« 
mov eax,8 ; ᮧ¤ ñ¬ ª­®¯ªã
int 0x40
 
; ¯¨è¥¬ ⥪áâ ­  ª­®¯ª¥
pushad ; ᯠᠥ¬ ॣ¨áâàë
shr ecx, 16
and ebx, 0xffff0000
add ebx, ecx ; ebx = [x] shl 16 + [y];
add ebx, 10*65536+4 ; ebx += ᬥ饭¨¥ ®â­®á¨â¥«ì­® ªà ï ª­®¯ª¨;
mov ecx, [sc.work_text] ; èà¨äâ ¨ 梥â
or ecx, font
add edx, -10 ; edx = ­®¬¥à ª­®¯ª¨;
imul edx, string_length ; edx *= ¤«¨­  áâப¨;
add edx, text ; edx += text; ⥯¥àì ¢ edx  ¤à¥á áâப¨
mov esi, string_length ; ¢ esi - ¤«¨­  áâப¨
mov eax, 4 ; äã­ªæ¨ï 4 - ¢ë¢®¤ ⥪áâ 
int 0x40
popad
 
inc edx ; ­®¬¥à ª­®¯ª¨++;
add ecx,15*65536 ; 㢥«¨ç¨¬ ᬥ饭¨¥ ¯® y
dec edi ; 㬥­ì訬 áçñâ稪
jnz newbtn ; ¥á«¨ ­¥ ­®«ì, ¯®¢â®à¨¬ ¢áñ ¥éñ à §
 
mov eax,12 ; § ª®­ç¨«¨ "à¨á®¢ âì"
mov ebx,2
int 0x40
 
ret ; ¢®§¢à â
 
 
 
; „€›… Žƒ€ŒŒ›
DATA
 
macro strtbl name, [string]
{
common
label name dword
forward
local str
dd str
forward
str db string
}
 
strtbl startapps ,\
<"/RD/1/PIC4",0> ,\
<"/RD/1/DESKTOP",0> ,\
<"/RD/1/MV",0> ,\
<"/RD/1/JPEGVIEW",0> ,\
<"/RD/1/CPU",0> ,\
<"/RD/1/SPANEL",0> ,\
<"/RD/1/ICONMNGR",0> ,\
<"/RD/1/VRR",0>
 
; header: ; § £®«®¢®ª
; db 'M E N U'
; header_len = $ - header
 
; text: ; ⥪áâ ­  ª­®¯ª å
; db 'Background '; 12
; db 'Colors '
; db 'MeView '
; db 'Processes '
; db 'Panel setup '
; db 'Icon manager'
 
sz header, "MenuetOS"
 
lsz text,\
en, 'Background ',\
en, 'Colors ',\
en, 'MeView ',\
en, 'JpegView ',\
en, 'Processes ',\
en, 'Panel setup ',\
en, 'Icon manager',\
en, 'VRR ',\
\
ru, 'ƒ¥­¥à â®à ®¡®¥¢ ',\
ru, '‘¨á⥬­ë¥ æ¢¥â  ',\
ru, 'à®á¬®âà BMP ',\
ru, 'à®á¬®âà JPEG ',\
ru, 'à®æ¥ááë ',\
ru, ' áâனª  ¯ ­¥«¨ ',\
ru, '“¯à ¢«¥­¨¥ ¨ª®­ª ¬¨ ',\
ru, ' áâனª  ¬®­¨â®à  '
 
 
 
; …ˆˆ–ˆ€‹ˆ‡ˆŽ‚€›… „€›…
UDATA
processes dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ ¢ á¨á⥬¥
curx1 dd ? ; ª®®à¤¨­ âë ªãàá®à 
cury1 dd ?
curx dd ? ; ª®®à¤¨­ âë ®ª­  ¬¥­î
cury dd ?
 
menu_opened db ? ; ®âªàëâ® ¬¥­î ¨«¨ ­¥â? (1-¤ , 0-­¥â)
 
align 32
start_info:
.mode dd ?
dd ?
.params dd ?
dd ?
.workarea dd ?
.path:
rb 256
 
 
sc system_colors ; á¨á⥬­ë¥ 梥â 
procinfo process_information ; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áá¥
 
work_area:
rb 0x1000
 
rb 1024 ; áâíª ¤«ï ®ª­  ¬¥­î - 墠â¨â ¨ 1 Š¡
align 32
stack_wnd:
 
 
MEOS_APP_END
; ŠŽ…– Žƒ€ŒŒ›
/programs/rb/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm @rb.asm @rb
@pause
/programs/rb/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm @rb.asm @rb
@pause
/programs/rb/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rccc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rccc.asm rccc
@pause
/programs/rccc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rccc.asm rccc
@pause
/programs/rccc/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rccc/trunk/rccc.asm
0,0 → 1,309
;
; Remote Control Center(Client)
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
;
; Ž¯¨á ­¨¥:
; à®£à ¬¬ , ¯à¥¤­ §­ ç¥­­ ï ¤«ï ã¯à ¢«¥­¨ï 㤠«ñ­­ë¬ ª®¬¯ìîâ¥à®¬.Š«¨¥­â᪠ï
; ç áâì.
;
; Compile with FASM for Menuet
; Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
;
 
 
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'
 
START: ; start of execution
 
mov eax,53 ; open socket
mov ebx,0
mov ecx,0x6000 ; local port
mov edx,0x6100 ; remote port
mov esi,dword [remote_ip] ; remote IP
int 0x40
 
mov [socket], eax
 
mov eax,53 ; send connect code
mov ebx,4
mov ecx,[socket]
mov edx,1
mov esi,connect
int 0x40
 
call draw_window ; at first, draw the window
 
still:
 
mov eax,23 ; wait here for event
mov ebx,1
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:
call draw_window
jmp still
 
key:
mov eax,2
int 0x40
jmp still
 
button:
mov eax,17
int 0x40
 
cmp ah,1 ; button id=1 ?
jnz noclose
mov eax, 53
mov ebx, 1
mov ecx, [socket]
int 0x40
mov eax,-1
int 0x40
noclose:
 
cmp ah,2 ; SEND SHUTDOWN COMMAND?
je send_shutdown
 
cmp ah,3 ; SEND REBOOT COMMAND?
je send_reboot
 
cmp ah,4 ; SEND SAVEFI COMMAND?
je send_savefi
 
cmp ah,5 ; SEND SAVEHI COMMAND?
je send_savehi
 
cmp ah,6 ; SEND HOTREBOOT COMMAND?
je send_hotreboot
 
cmp ah,7 ; SEND EXIT COMMAND?
je send_exit
 
jmp still
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SEND COMMANDS TO SERVER ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
send_shutdown:
 
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socket]
mov edx,1
mov esi,sen_shutdown
int 0x40
 
jmp still
 
send_reboot:
 
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socket]
mov edx,1
mov esi,sen_reboot
int 0x40
 
jmp still
 
send_savefi:
 
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socket]
mov edx,1
mov esi,sen_savefi
int 0x40
 
jmp still
 
send_savehi:
 
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socket]
mov edx,1
mov esi,sen_savehi
int 0x40
 
jmp still
 
send_hotreboot:
 
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socket]
mov edx,1
mov esi,sen_hotreboot
int 0x40
 
jmp still
 
send_exit:
 
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socket]
mov edx,1
mov esi,sen_exit
int 0x40
 
jmp still
 
get_data:
 
mov eax,53
mov ebx,3
mov ecx,[socket]
int 0x40
 
mov [edi],bl
inc edi
 
mov eax,53
mov ebx,2
mov ecx,[socket]
int 0x40
 
cmp eax,0
jne get_data
 
mov eax,4
mov ebx,30*65536+30
mov ecx,0x000000
mov edx,I_END
mov esi,15
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+250 ; [x start] *65536 + [x size]
mov ecx,60*65536+280 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
 
mov eax,8 ; CONTROL BUTTONS
mov ebx,25*65536+9
mov ecx,113*65536+9
mov edx,2
mov esi,0x667788
int 0x40
newbut:
int 0x40
add ecx,16*65536
inc edx
cmp edx,8
jb newbut
 
cld
mov ebx,25*65536+50 ; draw info text with function 4
mov ecx,0x000000
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
 
 
text:
db ' ‚६ï á¥à¢¥à : '
db ' '
db ' Œ¥­î ã¯à ¢«¥­¨ï á¥à¢¥à®¬: '
db ' '
db ' - ‚몫îç¨âì '
db ' - ¥à¥§ £à㧨âì '
db ' - ‘®åà ­¨âì ä«®¯¯¨-¨¬¥¤¦ '
db ' - ‘®åà ­¨âì ¨¬¥¤¦ †. ¤¨áª  '
db ' - ƒ®àï稩 à¥áâ àâ ï¤à  '
db ' - ‡ ªàë⨥ á¥à¢¥à­®© ç á⨠'
db ' '
db ' ‹®ª «ì­ë©  ¤à¥á : 192.168.0.1 '
db ' “¤ «ñ­­ë©  ¤à¥á : 192.168.0.2 '
db '€¤à¥á á¥à¢¥à  - ¢ ª®­æ¥ ¨á室­¨ª  '
db 'x <- END MARKER, DONT DELETE '
 
 
labeltext: db 'Remote Control Center(Client)' ;
lte:
 
socket dd 0x0
 
remote_ip db 192,168,0,2
 
sen_shutdown db 'S'
sen_reboot db 'R'
sen_savefi db 'F'
sen_savehi db 'H'
sen_hotreboot db 'O'
sen_exit db 'E'
connect db 'C'
 
I_END:
 
 
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rccs/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rccs.asm rccs
@pause
/programs/rccs/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rccs.asm rccs
@pause
/programs/rccs/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rccs/trunk/rccs.asm
0,0 → 1,334
;
; Remote Control Center(Server)
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
;
; Ž¯¨á ­¨¥:
; à®£à ¬¬ , ¯à¥¤­ §­ ç¥­­ ï ¤«ï ã¯à ¢«¥­¨ï 㤠«ñ­­ë¬ ª®¬¯ìîâ¥à®¬.‘¥à¢¥à­ ï
; ç áâì.
;
; Compile with FASM for Menuet
; Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
;
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'
remote_ip db 192,168,0,1
START: ; start of execution
mov eax, 53 ; open receiver socket
mov ebx, 0
mov ecx, 0x6100 ; local port
mov edx, 0x6000 ; remote port
mov esi, dword [remote_ip] ; remote IP
int 0x40
mov [socket],eax
mov [0],eax ; save for remote code
call draw_window ; at first, draw the window
still:
mov eax,23 ; wait here for event
mov ebx,1
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
mov eax,53 ; data from cluster terminal ?
mov ebx,2
mov ecx,[socket]
int 0x40
cmp eax,0
jne data_arrived
jmp still
red:
call draw_window
jmp still
key:
mov eax,2
int 0x40
jmp still
button:
mov eax,53
mov ebx,1
mov ecx,[socket]
int 0x40
mov eax,-1
int 0x40
data_arrived:
mov eax,5 ; wait a second for everything to arrive
mov ebx,10
int 0x40
mov edi,I_END
get_data:
mov eax,53
mov ebx,3
mov ecx,[socket]
int 0x40
mov [edi],bl
inc edi
mov eax,53
mov ebx,2
mov ecx,[socket]
int 0x40
cmp eax,0
jne get_data
cmp byte [I_END],'C' ;Connect ?
jne no_con
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_con
mov esi,29
int 0x40
add [y],10
 
jmp still
 
no_con:
cmp byte [I_END],'S' ; Shutdown ?
jne no_shut
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_shut
mov esi,26
int 0x40
add [y],10
 
mov eax,18
mov ebx,9
mov ecx,2
int 0x40
 
jmp still
 
no_shut:
cmp byte [I_END],'R' ; Reboot ?
jne no_reb
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_reb
mov esi,20
int 0x40
add [y],10
 
mov eax,18
mov ebx,9
mov ecx,3
int 0x40
jmp still
 
no_reb:
cmp byte [I_END],'F' ; Save image on floppi ?
jne no_savefi
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_savefi
mov esi,29
int 0x40
add [y],10
 
mov eax,18
mov ebx,9
mov ecx,1
int 0x40
jmp still
 
no_savefi:
cmp byte [I_END],'H' ; Save image on hard disk ?
jne no_savehi
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_savehi
mov esi,29
int 0x40
add [y],10
 
mov eax,18
mov ebx,6
mov ecx,2
int 0x40
 
jmp still
 
no_savehi:
cmp byte [I_END],'O' ; Hot reboot ?
jne no_hotreb
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_hotreb
mov esi,28
int 0x40
add [y],10
 
mov eax,18
mov ebx,9
mov ecx,4
int 0x40
jmp still
 
no_hotreb:
cmp byte [I_END],'E' ; Unload server ?
jne no_com
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_exit
mov esi,28
int 0x40
add [y],10
call button
jmp still
 
no_com:
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
mov ecx,0x000000
mov edx,inp_com
mov esi,22
int 0x40
add [y],10
 
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+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+330 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
mov eax,8
mov ebx,(286-19)*65536+12
mov ecx,4*65536+12
mov edx,1
mov esi,0xaabbcc
; int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
; Re-draw the screen text
cld
mov ebx,10*65536+30 ; draw info text with function 4
mov ecx,0x000000
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
text:
db '„ ­­ë©  ¤à¥á : 192.168.0.2 '
db 'à®á«ã訢 ¥¬ë© ¯®àâ : 0x6100 '
db '‘®áâ®ï­¨¥: '
db 'x <- END MARKER, DONT DELETE '
labeltext: db 'Remote Control Center(Server)'
lte:
socket dd 0x0
y dd 0x10
sysclock dd 0x0
 
inp_con db '‚­¨¬ ­¨¥, ¯®¤ª«î稫áï ª«¨¥­â!'
inp_shut db 'ˆ¤ñ⠮⪫î祭¨¥ á¨á⥬ë...'
inp_reb db 'ˆ¤ñâ ¯¥à¥§ £à㧪 ...'
inp_savefi db '‘®å࠭塞 ¨¬¥¤¦ ­  ¤¨áª¥âã...'
inp_savehi db '‘®å࠭塞 ¨¬¥¤¦ ­  †. ¤¨áª...'
inp_hotreb db 'ˆ¤ñâ £®àï稩 à¥áâ àâ ï¤à ...'
inp_exit db '‚ë室 ¨§ ¯à®£à ¬¬ë...'
inp_com db '¥®¯®§­ ­­ ï ª®¬¬ ­¤ !'
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rd2fd/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rd2fd.asm rd2fd
@pause
/programs/rd2fd/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rd2fd.asm rd2fd
@pause
/programs/rd2fd/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rd2fd/trunk/rd2fd.asm
0,0 → 1,228
;WARNING! Spaghetti code, size optimized
 
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" ; - 30 bytes !!!
 
 
START:
red: ; redraw
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
key: ; key
; just read it and ignore
int 0x40
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
je close
cmp ah,2
je ramdiskcopy
cmp ah,3
je ramdiskupdate
jmp togglewrite
close:
or eax,-1 ; close this program
jmp callsys
ramdiskcopy:
mov eax,16
xor ebx,ebx
inc ebx
jmp callsys
ramdiskupdate:
mov eax,16
xor ebx,ebx
inc ebx
inc ebx
jmp callsys
togglewrite:
call togglefdcwrite
callsys:
int 0x40
jmp still
 
; get fdc settings for writing & invert them.
togglefdcwrite:
mov eax,16
mov ebx,4
int 0x40
xchg ecx,eax
xor ecx,1
mov eax,16
dec ebx
int 0x40
 
mov [esp], dword still ; change return address !
;run trough drawwindow :]
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
 
mov eax,12 ; function 12:tell os about windowdraw
xor ebx,ebx ; 1, start of draw
inc ebx
int 0x40
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw win
mov ebx,100*65536+250 ; [x start] *65536 + [x size]
mov ecx,100*65536+120 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
int 0x40
 
;The important part, the buttons & text.
 
mov ebx,9*65536+36
mov ecx,41*65536+14
xor edx,edx
inc edx
inc edx
;mov edx,2
call clickbox
 
mov ebx,67*65536+49
inc edx
call clickbox
 
mov ebx,12*65536+12
mov ecx,81*65536+12
inc edx
call clickbox
 
mov ecx,96*65536+12
xor edx,edx
call clickbox
 
mov edi,0x10000000
mov edx,titlebar
mov ebx,9*65536+9
mov ecx,0x10ffffff
call print
 
; mov edx,h1
mov ebx,11*65536+28
mov ecx,0x10808080
call print
 
; mov edx,comtext
add ebx,15
xchg ecx,edi
call print
 
; mov edx,h2
add ebx,25
xchg ecx,edi
call print
 
; mov edx,setwrite
add ebx,15
xchg ecx,edi
call print
 
; mov edx,setread
add ebx,15
xchg ecx,edi
call print
 
mov eax,16
mov ebx,4
int 0x40
test al,1
je nowritex
; mov edx,xsign
mov ebx,14*65536+83
xchg ecx,edi
call print
nowritex:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
 
clickbox:
pusha
mov edi,edx
cmp edx, 0
je .disabledbox
mov eax,8 ; function 8 : define and draw button
int 0x40
.disabledbox:
inc ecx
inc ebx
mov eax,13
mov edx, 0x808080
int 0x40
cmp edi,0
je .grayed
mov edx,0x80
.grayed:
sub ebx,65536
sub ecx,65536
int 0x40
add ebx,65534
add ecx,65534
mov edx,0xffffff
int 0x40
popa
ret
 
print:
mov eax,edx
xor esi,esi
addchar:
inc eax
inc esi
cmp [eax],byte 0
jne addchar
mov eax,4
int 0x40
add edx,esi
inc edx
ret
 
 
; DATA AREA
 
titlebar: db 'RD2FD',0
h1: db 'Commands',0
comtext: db 'Copy or Update ramdisk to floppy',0
h2: db 'Settings',0
setwrite: db ' Write directly to floppy',0
setread: db ' Read directly from floppy',0
xsign: db 'X',0
I_END:
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rd2hd/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rd2hd.asm rd2hd
@pause
/programs/rd2hd/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rd2hd.asm rd2hd
@pause
/programs/rd2hd/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rd2hd/trunk/rd2hd.asm
0,0 → 1,161
;
; Save Ramdisk to HD
;
; Compile with FASM for Menuet
;
 
include 'lang.inc'
include 'macros.inc'
 
use32
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x1000 ; memory for app
dd 0x1000 ; esp
dd 0x0 ; , 0x0 ; I_Param , I_Icon
 
 
;******************************************************************************
 
 
START: ; start of execution
xor eax,eax
mov edi,bootpath
mov ecx,128
rep stosd
 
mcall 6,filename,0,-1,bootpath
 
mov esi,bootpath+1
mov cx,512
start_search:
lodsb
cmp al,"'"
jz set_end_path
dec cx
cmp cx,0
ja start_search
set_end_path:
mov [esi-1],byte 0
 
mov eax,40
mov ebx,101b
int 0x40
 
red:
call draw_window
 
still:
mov eax, 10 ; wait here for event
int 0x40
 
dec eax ; redraw request ?
je red
; dec eax
; dec eax ; button in buffer ?
; je button
 
 
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,2
jne ah_3
mcall 18,6,1
jmp red
ah_3:
cmp ah,3
jne ah_4
mcall 18,6,2
jmp red
ah_4:
cmp ah,4
jne ah_1
mcall 18,6,3,bootpath+1
jmp red
ah_1:
cmp ah,1
je exit
jmp still
 
exit:
or eax,-1 ; close this program
int 0x40
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
draw_window:
 
mov eax, 12 ; function 12:tell os about windowdraw
mov ebx, 1 ; 1, start of draw
int 0x40
; DRAW WINDOW
mov eax, 0 ; function 0 : define and draw window
mov ebx, 200*65536+220 ; [x start] *65536 + [x size]
mov ecx, 200*65536+150 ; [y start] *65536 + [y size]
mov edx, 0x03ccddee ; 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, header ; pointer to text beginning
mov esi, header.size ; text length
int 0x40
 
xor edx,edx
mcall 13,<15,20>,<30,20>
mcall 13, ,<60,20>
mcall 13, ,<90,20>
 
mcall 8,<16,17>,<31,17>,2,0xdd7700
inc edx
mcall 8, ,<61,17>, ,0xbb00
inc edx
mcall 8, ,<91,17>, ,0xcc5555
 
mcall 4,<22,36>,0x10ffffff,text_123,1
add bx,30
add edx,1
mcall 4
add bx,30
add edx,1
mcall 4
 
mcall 4,<45,36>,0,text_1,text_1.size
add bx,30
mcall 4, ,0,text_2,text_2.size
add bx,30
mcall 4, ,0,text_3,text_3.size
mcall 4,<20,120>,0,text_4,text_4.size
mcall 4,<40,130>,0,text_5,text_5.size
 
mcall 4,<40,46>,0,text_6,text_6.size
mcall 4,<40,106>,0,text_6,text_6.size
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
 
 
 
 
sz header, "RD2HD á®åà ­¨âì IMG>HD"
text_123 db '123'
sz text_1, '‚ ¯ ¯ªã /KOLIBRI'
sz text_2, '‚ ª®à¥­ì ¤¨áª '
sz text_3, 'ãâì ¢ ä ©«¥ RD2HD.TXT'
sz text_4, '¯.3 ¤«ï १¥à¢­®£® á®åà ­¥­¨ï,'
sz text_5, 'â.ª. ¢ ï¤à¥ ¥£® ­¥â.'
sz text_6, '(¯ ¯ª  ¤®«¦­  ¯à¨áãâá⢮¢ âì)'
filename db 'RD2HD TXT'
I_END:
bootpath:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rdfdel/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rdfdel.asm rdfdel
@pause
/programs/rdfdel/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rdfdel.asm rdfdel
@pause
/programs/rdfdel/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rdfdel/trunk/rdfdel.asm
0,0 → 1,232
;
; FILE COPIER
;
; 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
dd 0 ; 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,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:
 
 
cmp ah,3 ; delete ?
jnz nodelete
mov eax,32
mov ebx,destination
int 0x40
jmp still
nodelete:
 
 
cmp ah,4
jz f2
jmp nof12
 
f2:
mov [addr],dword destination
mov [ya],dword 35
jmp rk
 
rk:
mov edi,[addr]
mov al,' '
mov ecx,11
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
shr eax,8
cmp eax,8
jnz nobs
cmp edi,[addr]
jz f11
sub edi,1
mov [edi],byte 0
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,11
cmp esi,edi
jnz f11
 
jmp still
 
print_text:
 
mov eax,13
mov ebx,109*65536+11*6
mov ecx,[ya]
shl ecx,16
mov cx,8
mov edx,0xffffff
int 0x40
 
mov eax,4
mov ebx,109*65536
add ebx,[ya]
mov ecx,0x000000
mov edx,[addr]
mov esi,11
int 0x40
 
ret
 
nof12:
jmp still
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
mov ecx,100*65536+105 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; 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.len ; text length
int 0x40
 
mov esi,0xbbbbbb
 
mov eax,8 ; DELETE BUTTON
mov ebx,20*65536+190
mov ecx,63*65536+15
mov edx,3
int 0x40
 
mov eax,8
mov ebx,200*65536+10
mov ecx,33*65536+10
mov edx,4
int 0x40
 
mov esi,destination
mov edi,text+14
mov ecx,11
cld
rep movsb
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0x0
mov edx,text
mov esi,40
newline:
mov eax,4
int 0x40
add ebx,16*2
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
 
destination db 'EXAMPLE.ASM'
 
addr dd 0x0
ya dd 0x0
 
text:
db 'FILENAME : yyyyyyyyyyy '
db ' DELETE FROM RAMDISK '
 
db 'x' ; <- END MARKER, DONT DELETE
 
 
header:
db 'RAMDISK FILE DELETE'
.len = $ - header
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/remote/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm remote.asm remote
@pause
/programs/remote/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm remote.asm remote
@pause
/programs/remote/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/remote/trunk/remote.asm
0,0 → 1,229
;
; Remote processing example (remote node) - 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
dd 0x00000000 ; reserved=no extended header
include 'lang.inc'
include 'macros.inc'
remote_ip db 192,168,1,26
START: ; start of execution
mov eax, 53 ; open receiver socket
mov ebx, 0
mov ecx, 0x3000 ; local port
mov edx, 0xffff ; remote port
mov esi, dword [remote_ip] ; remote IP
int 0x40
mov [socketNum],eax
mov [0],eax ; save for remote code
call draw_window ; at first, draw the window
still:
mov eax,23 ; wait here for event
mov ebx,1
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
mov eax,53 ; data from cluster terminal ?
mov ebx,2
mov ecx,[socketNum]
int 0x40
cmp eax,0
jne data_arrived
jmp still
red:
call draw_window
jmp still
key:
mov eax,2
int 0x40
jmp still
button:
mov eax,53
mov ebx,1
mov ecx,[socketNum]
int 0x40
mov eax,-1
int 0x40
data_arrived:
mov eax,5 ; wait a second for everything to arrive
mov ebx,10
int 0x40
mov edi,I_END
get_data:
mov eax,53
mov ebx,3
mov ecx,[socketNum]
int 0x40
mov [edi],bl
inc edi
mov eax,53
mov ebx,2
mov ecx,[socketNum]
int 0x40
cmp eax,0
jne get_data
add byte [I_END+14],48
mov eax,4
mov ebx,10*65536+50
add ebx,[y]
mov ecx,0x000000
mov edx,I_END
mov esi,23
int 0x40
add [y],10
cmp byte [I_END+14],'1' ; DATA PACKET ?
jne no_packet
mov esi,I_END+23
mov edi,[I_END+15]
mov ecx,[I_END+19]
cld
rep movsb
jmp still
no_packet:
cmp byte [I_END+14],'2' ; EXECUTE ?
jne no_execute
mov eax,[I_END+15]
call eax
jmp still
no_execute:
jmp still
y dd 0x10
; *********************************************
; ******* 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+286 ; [x start] *65536 + [x size]
mov ecx,100*65536+330 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
mov eax,8
mov ebx,(286-19)*65536+12
mov ecx,4*65536+12
mov edx,1
mov esi,0xaabbcc
; int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
; Re-draw the screen text
cld
mov ebx,10*65536+30 ; draw info text with function 4
mov ecx,0x000000
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
text:
db 'THIS NODE : 192.168.1.22 '
db 'LISTENING TO PORT : 0x3000 '
db 'x <- END MARKER, DONT DELETE '
labeltext: db 'CLUSTER REMOTE'
lte:
socketNum dd 0x0
send_data db 'MenuetRemote00' ; 00 header ; -> remote port 0x3000
db 1 ; 14 send
dd 0x0 ; 15 position
dd 0x0 ; 19 size
; 23
execute db 'MenuetRemote00' ; 00 header ; -> remote port 0x3000
db 2 ; 14 execute
dd 0x0 ; 15 position
; 19
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtdata/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rtdata.asm rtdata
@pause
/programs/rtdata/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rtdata.asm rtdata
@pause
/programs/rtdata/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtdata/trunk/rtdata.asm
0,0 → 1,235
;
; COMMUNICATING WITH MODEM: PORTS & IRQ
;
; Compile with FASM for Menuet
;
 
include "lang.inc"
include "macros.inc"
 
use32
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x1000 ; memory for app
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
 
START: ; start of execution
 
 
mov eax,45 ; reserve irq 4
mov ebx,0
mov ecx,4
int 0x40
 
mov eax,46 ; reserve ports 0x3f8-0x3ff
mov ebx,0
mov ecx,0x3f8
mov edx,0x3ff
int 0x40
 
mov eax,44 ; read these ports at interrupt/irq 4
mov ebx,irqtable
mov ecx,4
int 0x40
 
mov eax,40 ; enable event for interrupt/irq 4
mov ebx,10000b shl 16 + 111b
int 0x40
 
call program_com1
 
call draw_window
 
still:
 
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
cmp eax,16+4 ; data read by interrupt ?
je irq4
 
jmp still
 
red: ; redraw
call draw_window
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
 
mov al,ah
mov dx,0x3f8
out dx,al
 
jmp still
 
button: ; button
or eax,-1 ; close this program
int 0x40
 
 
irq4:
 
mov eax,42
mov ebx,4
int 0x40
 
; eax = number of bytes left
; ecx = 0 success, =1 fail
; bl = byte
 
inc [pos]
and [pos],31
mov eax,[pos]
 
mov [string+eax], bl
call draw_string
 
jmp still
 
 
baudrate_9600 equ 12
baudrate_57600 equ 2
 
program_com1:
 
mov dx,0x3f8+3
mov al,0x80
out dx,al
 
mov dx,0x3f8+1
mov al,0x00
out dx,al
 
mov dx,0x3f8+0
mov al,baudrate_9600
out dx,al
 
mov dx,0x3f8+3
mov al,0x3
out dx,al
 
mov dx,0x3f8+4
mov al,0xb
out dx,al
 
mov dx,0x3f8+1
mov al,0x1
out dx,al
 
ret
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax, 48
mov ebx, 3
mov ecx, sc
mov edx, sizeof.system_colors
int 0x40
 
mov eax, 12 ; function 12:tell os about windowdraw
mov ebx, 1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
mov eax, 0 ; function 0 : define and draw window
mov ebx, 100*65536+250 ; [x start] *65536 + [x size]
mov ecx, 100*65536+85 ; [y start] *65536 + [y size]
mov edx, [sc.work]
or edx, 0x03000000 ; color of work area RRGGBB,8->color gl
int 0x40
 
; WINDOW LABEL
mov eax, 4 ; function 4 : write text to window
mov ebx, 8*65536+8 ; [x start] *65536 + [y start]
mov ecx, [sc.grab_text]
or ecx, 0x10000000 ; font 1 & color ( 0xF0RRGGBB )
mov edx, header ; pointer to text beginning
mov esi, header.len ; text length
int 0x40
 
mov eax, 4 ; draw text
mov ebx, 20*65536+33
mov ecx, [sc.work_text]
mov edx, text+4
.nextstr:
mov esi, [edx-4]
test esi, 0xFF000000
jnz .finstr
int 0x40
add edx, esi
add edx, 4
add ebx, 10
jmp .nextstr
.finstr:
 
call draw_string
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
draw_string:
mov eax, 4
mov ebx, 20*65536+65
mov ecx, [sc.work_text]
mov edx, string
mov esi, 32
int 0x40
ret
 
 
; DATA AREA
 
 
if lang eq ru
text mstr "‚‚Ž„ˆŒ›… ‘ˆŒ‚Ž‹› ……„€ž’‘Ÿ ŒŽ„…Œ“.",\
"„€›… Ž’ ŒŽ„…Œ€ ‘—ˆ’›‚€ž’‘Ÿ Ž",\
"…›‚€ˆž IRQ4 ˆ Ž’Ž€†€ž’‘Ÿ ˆ†…."
header:
db 'ŒŽ„…Œ € COM1'
.len = $ - header
else
text mstr "TYPED CHARACTERS ARE SENT TO MODEM.",\
"DATA FROM MODEM IS READ BY IRQ4",\
"INTERRUPT AND DISPLAYED BELOW."
header:
db 'MODEM AT COM1'
.len = $ - header
end if
 
pos dd 0x0
 
irqtable:
; port ; 1=byte, 2=word
dd 0x3f8 +0x01000000 ; read byte from port 0x3f8 at interrupt/irq 4
dd 0x0 ; no more ports ( max 15 ) to read
 
 
I_END:
 
string rb 32
sc system_colors
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/READER.RTF
0,0 → 1,30
{\rtf1\ansi\ansicpg1251{\colortbl;\red0\green0\blue0;
\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}\pard\plain
\qc \li0\ri0\faauto\rin0\lin0 \fs24\cgrid\langnp1049 {\b\fs28\cf11 RTF Reader for MenuetOS
\par }{\f36\fs20 \'e2\'e5\'f0\'f1\'e8\'ff 1}{\f1\fs20 .}{\f36\fs20 032}{\b\f1\fs20\cf11
\par }{\f36\fs20
\par }\pard \qr \li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'ed\'e0\'ef\'e8\'f1\'e0\'ed \'ed\'e0 \'f7\'e8\'f1\'f2\'ee\'ec \'e0\'f1\'f1\'e5\'ec\'e1\'eb\'e5\'f0\'e5 \'c8\'e2\'f3\'f8\'ea\'e8\'ed\'fb\'ec \'c0\'ed\'e4\'f0
\'e5\'e5\'ec}{\f1\fs20 aka Willow
\par }\pard \ql \li0\ri0 {\f1\fs20
\par }\pard \ql \fi710\li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'cf\'f0\'ee\'e3\'f0\'e0\'ec\'ec\'e0 \'ef\'ee\'ea\'e0 \'ee\'e1\'eb\'e0\'e4\'e0\'e5\'f2 \'ed\'e5\'e1\'ee\'eb\'fc\'f8\'e8\'ec\'e8 \'e2\'ee\'e7\'ec\'ee\'e6\'ed\'ee\'f1\'f2
\'ff\'ec\'e8:
\par {\pntext\pard\plain\f3\fs20 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi710\li0\ri0{\*\pn \ilvl0\ls1\pnrnot0\pnf3 { \'b7}}\faauto\ls1\rin0\lin0 {\f36\fs20 \tab \'f7\'f2\'e5\'ed\'e8\'e5
}{\f1\fs20 RTF }{\f36\fs20 \'f4\'ee\'f0\'ec\'e0\'f2\'e0 \'e1\'e5\'e7 \'ef\'ee\'e4\'e4\'e5\'f0\'e6\'ea\'e8 \'e2\'ed\'e5\'e4\'f0\'e5\'ed\'ed\'fb\'f5 \'ee\'e1\'fa\'e5\'ea\'f2\'ee\'e2, \'f2\'e0\'e1
\'eb\'e8\'f6, \'f8\'f0\'e8\'f4\'f2\'ee\'e2;}{\f36\fs20
\par {\pntext\pard\plain\f3\fs20 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}{\f36\fs20 \tab \'e7\'e0\'f7\'e0\'f2\'ee\'f7\'ed\'fb\'e5 \'f1\'ef\'ee\'f1\'ee\'e1\'ed\'ee\'f1\'f2\'e8 \'f4\'ee\'f0\'ec\'e0\'f2\'e8\'f0\'ee\'e2\'e0\'ed\'e8\'ff \'e0\'e1\'e7\'e0
\'f6\'e5\'e2;}{\f36\fs20
\par {\pntext\pard\plain\f3\fs20 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}{\f36\fs20 \tab \'ee\'f2\'ea\'f0\'fb\'e2\'e0\'e5\'ec\'fb\'e5 \'f4\'e0\'e9\'eb\'fb \'ec\'ee\'e3\'f3\'f2 \'e8\'ec\'e5\'f2\'fc }{\f36\fs20\cf6 \'ee\'f7\'e5\'ed\'fc
}{\f36\fs20 \'e1\'ee\'eb\'fc\'f8\'f3\'fe \'e4\'eb\'e8\'ed\'f3 (\'ed\'f3\'e6\'ed\'ee, \'ea\'f1\'f2\'e0\'f2\'e8, \'ef\'f0\'ee\'e2\'e5\'f0\'e8\'f2\'fc)!}{\f36\fs20
\par }\pard \ql \li0\ri0\faauto\rin0\lin0 {\f36\fs20
\par }\pard \qc \li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'cd\'e0\'e7\'ed\'e0\'f7\'e5\'ed\'e8\'e5 \'ea\'ed\'ee\'ef\'ee\'ea "\'ef\'e0\'ed\'e5\'eb\'e8 \'e8\'ed\'f1\'f2\'f0\'f3\'ec\'e5\'ed\'f2\'ee\'e2":
\par }\pard \ql \li0\ri0\faauto\rin0\lin0 {\b\f1\fs20\cf6 L }{\f1\fs20 - }{\f36\fs20 \'ee\'f2\'ea\'f0\'fb\'f2\'fc \'e4\'e8\'e0\'eb\'ee
\'e3 \'e2\'fb\'e1\'ee\'f0\'e0 \'f4\'e0\'e9\'eb\'e0 (\'e1\'e5\'e7 }{\f1\fs20 SYSXTREE }{\f36\fs20 \'f0\'e0\'e1\'ee\'f2\'e0\'f2\'fc \'ed\'e5 \'e1\'f3\'e4\'e5\'f2);
\par }{\b\f36\fs20\cf11 \'c0}{\f36\fs20 - \'e2\'ea\'eb\'fe\'f7\'e8\'f2\'fc/\'e2\'fb\'ea\'eb\'fe\'f7\'e8\'f2\'fc \'e2\'fb\'f0\'e0\'e2\'ed\'e8\'e2\'e0\'ed\'e8\'e5 \'e0\'e1\'e7\'e0\'f6\'e5\'e2;
\par }{\b\f36\fs20\cf2 \'d1}{\f36\fs20 - \'e2\'ea\'eb\'fe\'f7\'e8\'f2\'fc/\'e2\'fb\'ea\'eb\'fe\'f7\'e8\'f2\'fc \'f6\'e2\'e5\'f2\'ed\'ee\'e9 \'f8\'f0\'e8\'f4\'f2.
\par }{\f1\fs20
\par \tab }{\f36\fs20 \'ca\'ed\'ee\'ef\'ea\'e8 \'e4\'f3\'e1\'eb\'e8\'f0\'ee\'e2\'e0\'ed\'fb \'f1 \'ea\'eb\'e0\'e2\'e8\'e0\'f2\'f3\'f0\'fb (\'e8\'f1\'ef\'ee\'eb\'fc\'e7\'f3\'e9\'f2\'e5 \'ec\'e0\'eb\'e5\'ed\'fc\'ea\'e8\'e5 \'e1\'f3\'ea\'e2\'fb).
\'d0\'e0\'e1\'ee\'f2\'e0\'fe\'f2 \'ea\'eb\'e0\'e2\'e8\'f8\'e8 \'f1\'f2\'f0\'e5\'eb\'ee\'ea, }{\b\f1\fs20 PgUp}{\f1\fs20 , }{
\b\f1\fs20 PgDn}{\f1\fs20 , }{\f36\fs20 \'e8 }{\b\f1\fs20 Home}{\f36\fs20 .
\par \tab \'cf\'ee\'ea\'e0 \'e2\'f1\'e5!}{\f36\fs20
\par }}
/programs/rtfread/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/bgifont.inc
0,0 → 1,692
; 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 [BGIheight],dx
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
BGIheight dw ?
deform dd ?
BGIangle dd ?
Xscale dd ?
Yscale dd ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rtfread.asm rtfread
@pause
/programs/rtfread/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rtfread.asm rtfread
@pause
/programs/rtfread/trunk/debug.inc
0,0 → 1,137
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
 
_debug_crlf db 13, 10, 0
 
macro newline
{
pushf
pushad
mov edx, _debug_crlf
call debug_outstr
popad
popf
}
 
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'
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/rtf_lite.inc
0,0 → 1,635
;workarea: <- RTF_work
; listptr dd savelist 0
; szKeyword rb 31 4
; szParameter rb 21 35
 
include 'rtftype.inc'
include 'rtfactn.inc'
 
read_next_block:
inc [cur_block]
read_block:
mov esi,I_END
pusha
mov ecx,[cur_block]
mov ebx,fileinfo
mov eax,ecx
shl eax,7
mov [ebx+4],eax
; mov [ebx+12],esi
mcall 58
if DEBUG_BLOCK eq 1
; dps 'B='
; dpd ecx
; dps <13,10>
end if
cmp ecx,[max_block]
je .last
mov ebx,I_END+RTFSIZE
jmp .add
.last:
mov ebx,[tail]
; dpd ebx
.add:
; dpd ebx
mov [block_end],ebx
popa
; dpd esi
; dps <13,10>
ret
;
; %%Function: ecRtfParse
;
; Step 1:
; Isolate RTF keywords and send them to ecParseRtfKeyword;
; Push and pop state at the start and end of RTF groups;
; Send text to ecParseChar for further processing.
;
macro CopySave _src,_dest
{
pusha
mov ecx,SIZE_save
mov esi,_src
mov edi,_dest
rep movsb
popa
}
 
RtfParse:
 
if BENCH eq 1
mcall 26,9
mov [bench],eax
end if
mov [RetroPtr],esi
CopySave Chp,RetroSave
push dword[Free+4]
pop dword[RetroXY]
xor eax,eax
mov [cur_block],eax
mov [RetroBlock],eax
push [cGroup]
pop [RetroGroup]
and [mode],not RTF_BLIND
mov [listptr],save_stack
mov [fileinfo.size],128
; test ebp,RTF_HELP
test [mode],RTF_HELP
jne .noread
call read_block
.noread:
mov [RetroPtr],esi
.nib2:
mov [nibble],2
and [b],al
.getc:
xor eax,eax
lods_block
cmp [cGroup],0
jge .ok1
Return ecStackUnderflow
.ok1:
cmp [ris],risBin
jne .nobin
RetError ecParseChar
.nobin:
cmp al,'{'
jne .nobr1
RetError ecPushRtfState
.nobr1:
cmp al,'}'
jne .nobr2
RetError ecPopRtfState
.nobr2:
cmp al,'\'
jne .noslash
RetError ecParseRtfKeyword
.noslash:
cmp al,0xd
je .getc
cmp al,0xa
je .getc
.nouc:
cmp [ris],risNorm
jne .nonorm
call ecParseChar
cmp eax,ecOutOfWindow
je .__ex
test eax,eax
je .getc
jmp .__ex
.nonorm:
cmp [ris],risHex
je .noassert
Return ecAssertion
.noassert:
shl [b],4
isdigit al, .nodig
sub al,'0'
add [b],al
jmp .nibble
.nodig:
islower al, .nolow
cmp al,'a'
jb .inval
cmp al,'f'
ja .inval
sub al,'a'-10
jmp .nib0
.inval:
if INVALHEX eq 0
jmp .getc
else
; sub esi,I_END+1
; dpd esi
; movzx eax,al
; dpd eax
; movzx eax,[b]
; dpd eax
Return ecInvalidHex
end if
.nolow:
cmp al,'A'
jb .inval
cmp al,'F'
ja .inval
sub al,'A'-10
.nib0:
add [b],al
.nibble:
dec [nibble]
cmp [nibble],0
jnz .getc
movzx eax,[b]
mov [ris],risNorm
call ecParseChar
test eax,eax
jnz .__ex
; mov [ris],risNorm
jmp .nib2
.eof:
xor eax,eax
cmp eax,[cGroup]
je .__ex
jg .unbr
Return ecStackUnderflow
.unbr:
mov eax,ecUnmatchedBrace
.__ex:
ret
nibble db 2
b db 0
RTF_maxlist dd ?
;
; %%Function: ecParseRtfKeyword
;
; Step 2:
; get a control word (and its associated value) and
; call ecTranslateKeyword to dispatch the control.
;
 
ecParseRtfKeyword:
; ch-al,bl-fParam, bh-fNeg
mov [ris],risNorm
xor eax,eax
xor ebx,ebx
push edx
mov [szKeyword],al
mov [szParameter],al
lods_block
isalpha al,.ctrl
jmp .alph
.ctrl:
push esi
mov esi,szKeyword
inc byte[esi]
mov [esi+1],al
mov eax,ebx
xor ebx,ebx
call ecTranslateKeyword
pop esi
jmp .__ex
.alph:
push edi
mov edi,szKeyword+1
.loop1:
stosb
inc [szKeyword]
lods_block
isalpha al,.outloop1
jmp .loop1
.outloop1:
pop edi
cmp al,'-'
jne .noneg
not bh
lods_block
.noneg:
isdigit al,.nodig
not bl
push edi
mov edi,szParameter+1
.loop2:
stosb
inc [szParameter]
lods_block
isdigit al,.outloop2
jmp .loop2
.outloop2:
pop edi
push eax esi
mov esi,szParameter
atoi
pop esi
mov edx,eax
pop eax
mov [lParam],edx
test bh,bh
jz .nodig
neg edx
.nodig:
cmp al,' '
je .space
cmp esi,I_END
jne .ok_block
dec [cur_block]
call read_block
mov esi,[block_end]
.ok_block:
dec esi
.space:
mov eax,ebx
mov ebx,edx
push esi
mov esi,szKeyword
call ecTranslateKeyword
pop esi
.__ex:
pop edx
ret
 
;
; %%Function: ecParseChar
;
; Route the character to the appropriate destination stream.
;
 
ecParseChar:
;in: ch-al, esi->rtf
cmp [ris],risBin
jne .nobin
dec [cbBin]
cmp [cbBin],0
jg .nobin
mov [ris],risNorm
.nobin:
cmp [rds],rdsColor
jne .nodelim
cmp al,';'
jne .non
mov eax,[colorptr]
cmp eax,ct_end-4
jae .non
add [colorptr],4
jmp .non
.nodelim:
cmp [rds],rdsSkip
je .non
cmp [rds],rdsNorm
je ecPrintChar
; ret
.non:
mov eax,ecOK
ret
 
macro PrintTrap _char
{
local .notrap
cmp byte[esi],_char
jne .notrap
sub esi,I_END
dps 'Trapped at '
dpd esi
dps <13,10>
ud2
.notrap:
}
;
; %%Function: ecPrintChar
;
; Send a character to the output file.
;
 
ecPrintChar:
; in:ch-al, esi - rtf pointer
; stosb
; jmp .nowrap
mov ebp,[mode]
cmp al,0xa
jne .nopar
; and ebp,not RTF_NO1STLINE
and [mode],not RTF_NO1STLINE
jmp .par
.nopar:
cmp al,0x9
jne .notab
add word[Free+6],CHARW*3
jmp .chkwrap
.notab:
xor ebx,ebx
if ~ RENDER eq FREE
cmp word[Free+4],TOP
jl .nodraw
end if
ansi2oem
mov [char],al
; PrintTrap '/'
pusha
xor eax,eax
; test [mode],RTF_BLIND
test ebp,RTF_BLIND
je .rend
; test [mode],RTF_COLORLESS
test ebp,RTF_COLORLESS
jz .setcolor
mov ecx,DEFCOLOR
jmp .rend
.setcolor:
movzx ecx,byte[Chp+3]
mov ecx,[colortbl+ecx*4]
.rend:
if RENDER eq FREE
mov ebx,Free
mov dword[ebx+32],eax
mov [ebx+28],ecx
; test [mode], RTF_BOTTOM
test ebp, RTF_BOTTOM
jne .nodraw2
cmp word[Free+4],TOP
jl .nodraw2
cmp byte[Chp],fTrue
jne .nobold
or dword[ebx+32],BGI_BOLD
.nobold:
; test [mode], RTF_BLIND
test ebp, RTF_BLIND
jne .freet
.nodraw2:
or dword[ebx+32],BGI_NODRAW
.freet:
BGIfont_Freetext
 
mov [Free+4],eax
test [mode],RTF_BLIND
; jmp .nohei
jne .nohei
fild word[BGIheight]
fmul dword[Free+12]
; fistp word[curheight]
fistp word[maxheight]
; movzx eax,[curheight]
; dpd eax
; cmp ax,[maxheight]
; jae .nohei
; mov [maxheight],ax
; dps 'M'
; dpd eax
 
; dps <13,10>
.nohei:
else
and ecx,0xffffff
mov ebx,[Free+4]
mov edx,char
mov esi,1
end if
 
if RENDER eq BGI
add ecx,0x44000000
cmp byte[Chp],fTrue
jne .nobold
or esi,BGI_BOLD
.nobold:
test ebp,RTF_BLIND
; test [mode],RTF_BLIND
jne .freet
or esi,BGI_NODRAW
.freet:
BGIfont_Outtext
mov [Free+4],eax
end if
 
if RENDER eq PIX
; test [mode],RTF_TOEOF
; jne .blind
; test [mode],RTF_BOTTOM
test ebp,RTF_BOTTOM
jne .nobold
.blind:
; test [mode],RTF_BLIND
test ebp,RTF_BLIND
je .nobold
mcall 4
cmp byte[Chp],fTrue
jne .nobold
add ebx,1 shl 16
mcall
.nobold:
end if
popa
.nodraw:
if RENDER eq PIX
add word[Free+6],CHARW
end if
movsx eax,[pitch]
add word[Free+6],ax
.chkwrap:
mov eax,dword[prcinfo+42]
cmp ax,word[Free+6]
ja .nowrap
; or ebp,RTF_NO1STLINE
or [mode],RTF_NO1STLINE
.par:
xor [mode],RTF_BLIND
; not [blind]
test [mode] ,RTF_BLIND
je .makewrap
; [blind]=false
movzx eax,word[Free+6]
sub ax,word[RetroXY+2]
push dword[RetroXY]
pop dword[Free+4]
mov [mark],0xff0000
test [mode],RTF_ALIGNLESS
jnz .letsdraw
cmp byte[Pap+12],justR
jb .letsdraw
mov [mark],0xff
mov ebx,dword[prcinfo+42] ; wnd width
sub ebx,eax
cmp byte[Pap+12],justC
jne .nocenter
shr ebx,1
mov [mark],0x00ff00
.nocenter:
mov word[Free+6],bx
.letsdraw:
; test [mode],RTF_NO1STLINE
; jnz .no1st
; add word[Free+6],60
.no1st:
if STEPBYSTEP eq 1
; movzx eax,[mode]
; dph eax
; test [mode],RTF_NO1STLINE
; jnz .no1st
; mcall 4,[RetroXY],[mark],sym,1
; dps '1st '
; .no1st:
dps <'false ',13,10>
; dpd eax
; dpd ebx
end if
if SHOWALIGN eq 1
mcall 4,[RetroXY],[mark],sym,1
end if
if STEPBYSTEP eq 1
mcall 10
mcall 2
end if
mov eax,[RetroBlock]
cmp eax,[cur_block]
je .norblock
mov [cur_block],eax
call read_block
.norblock:
mov esi,[RetroPtr]
push [RetroGroup]
pop [cGroup]
CopySave RetroSave,Chp
jmp .nowrap
.makewrap: ; second pass preparing
; [blind]=true
if STEPBYSTEP eq 1
dps 'true '
mcall 10
mcall 2
end if
mov word[Free+6],LMARGIN
if RENDER eq FREE
fld [line_space]
fimul [maxheight]
fistp [maxheight]
movzx eax,[maxheight]
add word[Free+4],ax
; and [maxheight],0
; add word[Free+4],CHARH
else
mov eax,CHARH
add word[Free+4],ax
end if
test [mode],RTF_TOEOF
je .nohdoc
add [HDoc],eax
inc [line_count]
.nohdoc:
test [mode],RTF_BOTTOM
jne .text
; dps '1'
mov ebx,dword[prcinfo+46]
cmp bx,word[Free+4]
jge .text
or [mode],RTF_BOTTOM
dps <'btm',13,10>
test [mode],RTF_TOEOF
jne .text
mov eax,ecOutOfWindow
ret
; end if
.text:
push dword[Free+4]
pop dword[RetroXY]
mov word[RetroXY+2],LMARGIN
mov [RetroPtr],esi
push [cur_block]
pop [RetroBlock]
CopySave Chp,RetroSave
push [cGroup]
pop [RetroGroup]
; if STEPBYSTEP eq 1
; mcall 10
; mcall 2
; end if
.nowrap:
mov eax,ecOK
ret
mark dd ?
sym db 0x10
line_space dd 1.6
;
; %%Function: ecPushRtfState
;
; Save relevant info on a linked list of SAVE structures.
;
 
ecPushRtfState:
pusha
mov edi,[listptr]
mov eax,edi
mov ecx,SIZE_save
add eax,ecx
cmp eax,save_limit
jb .malloc
Return ecStackOverflow
.malloc:
mov esi,Chp
rep movsb
mov [listptr],edi
mov [ris],risNorm
inc [cGroup]
xor eax,eax
Epilog
 
; %%Function: ecPopRtfState
;
; If we're ending a destination (that is, the destination is changing),
; call ecEndGroupAction.
; Always restore relevant info from the top of the SAVE list.
 
ecPopRtfState:
pusha
mov esi,[listptr]
cmp esi,save_stack
ja .okpop
Return ecStackUnderflow
.okpop:
movzx eax,[rds]
cmp al,[esi-2]
je .noega
RetError ecEndGroupAction, .noega
.noega:
mov ecx,SIZE_save
sub esi,ecx
mov [listptr],esi
mov edi,Chp
rep movsb
dec [cGroup]
xor eax,eax
Epilog
 
ansitbl:
db 0xaa,0xba,0xbf,0xaf
db 0xa7,0xa8,0xa1,0xab,0xb0,0xb2,0xb3,0xb6,0xb7,0xb8,0xb9
db 0xa2,0xbb,0x93,0x94,0x85
oematbl:
if RENDER eq PIX
db 0xf2,0xf3,0xf5,0xf4
else
db 0x85,0xa5,0x69,0x49
end if
db 0x15,0xf0,0xf6,0x22,0x1d,0x49,0x69,0x14,0x1c,0xf1,0x23
db 0xf7,0x22,0x22,0x22,0x16
uctbl:
dw 0x451
oemutbl:
db 0xb8
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/rtfactn.inc
0,0 → 1,389
 
rgsymRtf:
; Keyword descriptions
;rgsymRtf[] = {
; keyword dflt fPassDflt kwd idx implemented
if syms eq 12
SYM "f", 0, fFalse, kwdProp, ipropFont
SYM "*", 0, fFalse, kwdSpec, ipfnSkipDest ,1
SYM "'", 0, fFalse, kwdSpec, ipfnHex ,1
SYM "par", 0, fFalse, kwdChar, 0x0a ,1
SYM "u", 0, fFalse, kwdUC, 0 ,1
SYM "line", 0, fFalse, kwdChar, 0xa ,1
SYM "plain", 0, fFalse, kwdProp, ipropPlain ,1
SYM 0x9, 0, fFalse, kwdChar, 0x09 ,1
SYM "tab", 0, fFalse, kwdChar, 0x09 ,1
SYM "b", 1, fFalse, kwdProp, ipropBold ,1
SYM "ul", 1, fFalse, kwdProp, ipropUnderline
SYM "i", 1, fFalse, kwdProp, ipropItalic ,1
SYM "li", 0, fFalse, kwdProp, ipropLeftInd
SYM "ri", 0, fFalse, kwdProp, ipropRightInd
SYM "fi", 0, fFalse, kwdProp, ipropFirstInd
SYM "~", 0, fFalse, kwdChar, ' ' ,1
SYM "cols", 1, fFalse, kwdProp, ipropCols
SYM "qc", justC, fTrue, kwdProp, ipropJust ,1
SYM "ql", justL, fTrue, kwdProp, ipropJust ,1
SYM "qr", justR, fTrue, kwdProp, ipropJust ,1
SYM "qj", justF, fTrue, kwdProp, ipropJust
SYM "cf", 0, fFalse, kwdProp, ipropForeColor ,1
SYM "red", 0, fFalse, kwdColor, 16 ,1
SYM "green", 0, fFalse, kwdColor, 8 ,1
SYM "blue", 0, fFalse, kwdColor, 0 ,1
SYM "fs", 0, fFalse, kwdProp, ipropFontSize ,1
SYM "sbknone", sbkNon, fTrue, kwdProp, ipropSbk
SYM "sbkcol", sbkCol, fTrue, kwdProp, ipropSbk
SYM "sbkeven", sbkEvn, fTrue, kwdProp, ipropSbk
SYM "sbkodd", sbkOdd, fTrue, kwdProp, ipropSbk
SYM "sbkpage", sbkPg, fTrue, kwdProp, ipropSbk
SYM "pgnx", 0, fFalse, kwdProp, ipropPgnX
SYM "pgny", 0, fFalse, kwdProp, ipropPgnY
SYM "pgndec", pgDec, fTrue, kwdProp, ipropPgnFormat
SYM "pgnucrm", pgURom, fTrue, kwdProp, ipropPgnFormat
SYM "pgnlcrm", pgLRom, fTrue, kwdProp, ipropPgnFormat
SYM "pgnucltr", pgULtr, fTrue, kwdProp, ipropPgnFormat
SYM "pgnlcltr", pgLLtr, fTrue, kwdProp, ipropPgnFormat
SYM "paperw", 12240, fFalse, kwdProp, ipropXaPage
SYM "paperh", 15480, fFalse, kwdProp, ipropYaPage
SYM "margl", 1800, fFalse, kwdProp, ipropXaLeft
SYM "margr", 1800, fFalse, kwdProp, ipropXaRight
SYM "margt", 1440, fFalse, kwdProp, ipropYaTop
SYM "margb", 1440, fFalse, kwdProp, ipropYaBottom
SYM "pgnstart", 1, fTrue, kwdProp, ipropPgnStart
SYM "facingp", 1, fTrue, kwdProp, ipropFacingp
SYM "landscape",1, fTrue, kwdProp, ipropLandscape
SYM "ldblquote",0, fFalse, kwdChar, '"' ,1
SYM "rdblquote",0, fFalse, kwdChar, '"' ,1
SYM "bin", 0, fFalse, kwdSpec, ipfnBin ,1
SYM "author", 0, fFalse, kwdDest, idestSkip
SYM "buptim", 0, fFalse, kwdDest, idestSkip
SYM "bullet", 0, fFalse, kwdChar, '*' ,1
SYM "cell", 0, fFalse, kwdChar, 0x09 ,1
SYM "colortbl", 0, fFalse, kwdDest, idestColor ,1
SYM "comment", 0, fFalse, kwdDest, idestSkip
SYM "creatim", 0, fFalse, kwdDest, idestSkip
SYM "doccomm", 0, fFalse, kwdDest, idestSkip
SYM "fonttbl", 0, fFalse, kwdDest, idestSkip
SYM "footer", 0, fFalse, kwdDest, idestSkip
SYM "footerf", 0, fFalse, kwdDest, idestSkip
SYM "footerl", 0, fFalse, kwdDest, idestSkip
SYM "footerr", 0, fFalse, kwdDest, idestSkip
SYM "footnote", 0, fFalse, kwdDest, idestSkip
SYM "ftncn", 0, fFalse, kwdDest, idestSkip
SYM "ftnsep", 0, fFalse, kwdDest, idestSkip
SYM "ftnsepc", 0, fFalse, kwdDest, idestSkip
SYM "header", 0, fFalse, kwdDest, idestSkip
SYM "headerf", 0, fFalse, kwdDest, idestSkip
SYM "headerl", 0, fFalse, kwdDest, idestSkip
SYM "headerr", 0, fFalse, kwdDest, idestSkip
SYM "info", 0, fFalse, kwdDest, idestSkip
SYM "keywords", 0, fFalse, kwdDest, idestSkip
SYM "operator", 0, fFalse, kwdDest, idestSkip
SYM "pict", 0, fFalse, kwdDest, idestSkip
SYM "printim", 0, fFalse, kwdDest, idestSkip
SYM "private1", 0, fFalse, kwdDest, idestSkip
SYM "revtim", 0, fFalse, kwdDest, idestSkip
SYM "row", 0, fFalse, kwdChar, 0x0a ,1
SYM "rxe", 0, fFalse, kwdDest, idestSkip
SYM "stylesheet",0, fFalse, kwdDest, idestSkip
SYM "subject", 0, fFalse, kwdDest, idestSkip
SYM "tc", 0, fFalse, kwdDest, idestSkip
SYM "title", 0, fFalse, kwdDest, idestSkip
SYM "trowd", 0, fFalse, kwdChar, 0x0a ,1
SYM "txe", 0, fFalse, kwdDest, idestSkip
SYM "xe", 0, fFalse, kwdDest, idestSkip
SYM "{", 0, fFalse, kwdChar, '{' ,1
SYM "}", 0, fFalse, kwdChar, '}' ,1
SYM "\", 0, fFalse, kwdChar, '\' ,1
end if
SYM 0xa, 0, fFalse, kwdChar, 0x0a ,1
SYM 0xd, 0, fFalse, kwdChar, 0x0a ,1
 
;
; %%Function: ecApplyPropChange
;
; Set the property identified by _iprop_ to the value _val_.
;
ecApplyPropChange:
; in : eax-iprop, ebx - value
pusha
cmp [rds],rdsSkip
jne .noskip
.ok:
Return ecOK
.noskip:
lea esi,[eax*2+eax+rgprop] ;rgprop[iprop]
mov cx,word[esi]
movzx edx,byte[esi+2]
Prcheck Dop
Prcheck Sep
Prcheck Pap
Prcheck Chp
cmp byte[esi],actnSpec
jne .bad
.checked:
cmp cl,actnByte
jne .nob
mov byte[esi+edx],bl
jmp .ok
.nob:
cmp cl,actnWord
jne .now
mov [esi+edx],ebx
jmp .ok
.now:
cmp cl,actnSpec
jne .nos
call ecParseSpecialProperty
jmp .__ex
.nos:
cmp cl,actnFloatFS
jne .bad
mov [Chp+5],ebx
call updFS
jmp .ok
.bad:
mov eax,ecBadTable
Epilog
 
updFS:
cmp dword[Chp+5],0
jnz .no0
mov dword[Chp+5],24
.no0:
fild dword[Chp+5]
fmul dword[Free-4]
fst dword[Free+12]
fstp dword[Free+16]
ret
;
; %%Function: ecParseSpecialProperty
;
; Set a property that requires code to evaluate.
;
 
ecParseSpecialProperty:
; in : eax-iprop, ebx - value
; cmp al,ipropPard
; jne .nopap
; push eax
; mov ecx,SIZE_Pap
; mov edi,RetroSave+9
; xor eax,eax
; rep stosb
; pop eax
; .nopap:
MemSet ipropPard,Pap
MemSet ipropPlain,Chp
MemSet ipropSectd,Sep
mov eax,ecBadTable
ret
.ms:
xor eax,eax
rep stosb
ret
 
;
; %%Function: ecTranslateKeyword.
;
; Step 3.
; Search rgsymRtf for szKeyword and evaluate it appropriately.
;
; Inputs:
; szKeyword: The RTF control to evaluate.
; param: The parameter of the RTF control.
; fParam: fTrue if the control had a parameter; (that is, if param is valid
 
; fFalse if it did not.
ecTranslateKeyword:
; in: esi->pasKeyword; ebx-param, eax-fParam
pusha
mov edx,isymMax
mov edi,rgsymRtf
.next:
add edi,5
movzx ecx,byte[edi]
inc ecx
push edi esi ecx
repe cmpsb
pop ecx esi edi
jz .found
add edi,ecx
; inc edi
dec edx
test edx,edx
jne .next
cmp dl,[fSkipDestIfUnk]
jz .discard
mov [rds],rdsSkip
mov [fSkipDestIfUnk],dl
.discard:
Return ecOK
.found:
and [fSkipDestIfUnk],0
mov cx,[edi-3]
cmp ch,kwdProp
jne .nop
test cl,cl
jnz .usedeflt
test al,al
jnz .validparm
.usedeflt:
mov ebx,[edi-5]
.validparm:
movzx eax,byte[edi-1]
call ecApplyPropChange
jmp .__ex
.nop:
movzx eax,byte[edi-1]
cmp ch,kwdChar
jne .noc
.pchar:
mov edi,[esp]
test eax,eax
jz .__ex
mov esi,[esp+36]
call ecParseChar
mov [esp],edi
mov [esp+36],esi
jmp .__ex
.noc:
cmp ch,kwdDest
jne .nod
call ecChangeDest
jmp .__ex
.nod:
cmp ch,kwdSpec
jne .nos
call ecParseSpecialKeyword
jmp .__ex
.nos:
cmp ch,kwdColor
jne .nocol
cmp [rds],rdsColor
jne .bad
mov edx,[colorptr]
mov ecx,eax
mov esi,0xff
shl esi,cl
not esi
shl ebx,cl
and [edx],esi
or [edx],ebx
.okk:
Return ecOK
.nocol:
cmp ch,kwdUC
jne .bad
mov eax,[esp+36]
cmp byte[eax],'\'
je .nobyte
inc dword[esp+36]
.nobyte:
cmp ebx,0x400
jb .okk
mov eax,ebx
uc2oem
cmp ecx,1
jae .pchar
lea eax,[ebx-0x410+0xc0]
jmp .pchar
.bad:
mov eax,ecBadTable
Epilog
 
; %%Function: ecChangeDest
;
; Change to the destination specified by idest.
; There's usually more to do here than this...
 
ecChangeDest:
; in: eax- idest
cmp [rds],rdsSkip
jne .noskip
jmp .okk;Return ecOK
.noskip:
cmp eax,rdsColor
jne .nocol
mov [rds],al
jmp .okk
.nocol:
mov [rds],rdsSkip
.okk:
mov eax,ecOK
.ex:
ret
 
; %%Function: ecEndGroupAction
;
; The destination specified by rds is coming to a close.
; If there's any cleanup that needs to be done, do it now.
ecEndGroupAction:
; in: eax-rds
mov eax,ecOK
ret
 
; %%Function: ecParseSpecialKeyword
;
; Evaluate an RTF control that needs special processing.
 
ecParseSpecialKeyword:
; in: eax-IPFN
cmp [rds],rdsSkip
jne .noskip
cmp eax,ipfnBin
jne .ok
.noskip:
cmp eax,ipfnBin
jne .nobin
mov [ris],risBin
push [lParam]
pop [cbBin]
jmp .ok
.nobin:
cmp eax,ipfnSkipDest
jne .noskd
mov [fSkipDestIfUnk],fTrue
jmp .ok
.noskd:
cmp eax,ipfnHex
jne .nohex
mov [ris],risHex
jmp .ok
.nohex:
Return ecBadTable
.ok:
mov eax,ecOK
.__ex:
ret
 
; RTF parser tables
rgprop:
; Property descriptions
;PROP rgprop [ipropMax] = {
PROP actnByte, propChp, 0 ; ipropBold
PROP actnByte, propChp, 1 ; ipropItalic
PROP actnByte, propChp, 2 ; ipropUnderline
PROP actnWord, propPap, 0 ; ipropLeftInd
PROP actnWord, propPap, 4 ; ipropRightInd
PROP actnWord, propPap, 8 ; ipropFirstInd
PROP actnWord, propSep, 0 ; ipropCols
PROP actnWord, propSep, 5 ; ipropPgnX
PROP actnWord, propSep, 9 ; ipropPgnY
PROP actnWord, propDop, 0 ; ipropXaPage
PROP actnWord, propDop, 4 ; ipropYaPage
PROP actnWord, propDop, 8 ; ipropXaLeft
PROP actnWord, propDop, 12 ; ipropXaRight
PROP actnWord, propDop, 16 ; ipropYaTop
PROP actnWord, propDop, 20 ; ipropYaBottom
PROP actnWord, propDop, 24 ; ipropPgnStart
PROP actnByte, propSep, 4 ; ipropSbk
PROP actnByte, propSep, 13 ; ipropPgnFormat
PROP actnByte, propDop, 28 ; ipropFacingp
PROP actnByte, propDop, 29 ; ipropLandscape
PROP actnByte, propPap, 12 ; ipropJust
PROP actnSpec, propPap, 0 ; ipropPard
PROP actnSpec, propChp, 0 ; ipropPlain
PROP actnSpec, propSep, 0 ; ipropSectd
PROP actnByte, propChp, 3 ; ipropForeColor
PROP actnByte, propChp, 4 ; ipropFont
PROP actnFloatFS,propChp, 5 ; ipropFontSize
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/rtfread.asm
0,0 → 1,609
; RTF READER FOR MENUET v1.
; Written in pure assembler by Ivushkin Andrey aka Willow
;
;---------------------------------------------------------------------
M64 equ 64*1024
N_A equ 0x412f4e
RTFSIZE equ M64
RTFSTACKSIZE equ M64
BGIFONTSIZE equ 120*1024
ESPSIZE equ M64
LMARGIN equ 20
CHARW equ 6
CHARH equ 11
WINW equ 600
WINH equ 450
WIN_COLOR equ 0x3f0f0f0
DEFCOLOR equ 0x303030
;RENDER equ PIX
;RENDER equ BGI
RENDER equ FREE
 
BGIFONT_PATH equ '/rd/1/'
FONT_NAME equ 'LITT'
TOP =35
MODE equ RTF
INVALHEX equ 0
RTF_COLORLESS equ 1
RTF_ALIGNLESS equ 2
RTF_NO1STLINE equ 4
RTF_OPENING equ 8
RTF_HELP equ 16
RTF_VALID equ 32
RTF_BLIND equ 64
RTF_TOEOF equ 128
RTF_BOTTOM equ 256
STEPBYSTEP equ 10
DEBUG_BLOCK equ 10
SHOWALIGN equ 10
GUTTER equ 10
BENCH equ 0;1
syms equ 12
 
use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
org 0x0 ;  ¤à¥á æ¨ï á ­ã«ï
 
db 'MENUET01' ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
dd START ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
dd I_END0 ; à §¬¥à ¯à®£à ¬¬ë
dd esp_end ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
dd sys_mem ;  ¤à¥á ¢¥à設ë áâíª 
dd fname_buf ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
 
include 'lang.inc'
include 'macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
include 'debug.inc'
if ~ RENDER eq PIX
TOP=TOP+4
include 'bgifont.inc'
end if
include 'rtf_lite.inc'
include 'ascl.inc'
;---------------------------------------------------------------------
;--- €—€‹Ž Žƒ€ŒŒ› ----------------------------------------------
;---------------------------------------------------------------------
help_file:
file 'reader.rtf'
help_end:
 
START:
mov [pitch],2
if ~ RENDER eq PIX
mov edx,FONT_NAME
mov edi,save_limit
BGIfont_Prepare
end if
start2:
cmp byte[fname_buf],0
je load_file;top_red
jmp noactivate
prep_load:
; mcall 18,3,dword[prcinfo+30]
noactivate:
; and ebp,not RTF_OPENING
; and ebp,not RTF_HELP
 
; and [mode],not RTF_OPENING
and [mode],not (RTF_HELP+RTF_OPENING)
mov ecx,16
mov edi,fileinfo.name
mov esi,fname_buf
rep movsd
load_file:
xor eax,eax
mov ebx,fileinfo
mov [ebx+4],eax
inc eax
mov [fileinfo.size],eax
mcall 58
dpd ebx
and [wSave],0
mov [HClick],-100
load_help:
test eax,eax
jz .sizok
cmp eax,5
je .sizok
.nosizok:
mov dword[fileinfo.name],N_A
.sizok:
mov eax,ebx
and eax,RTFSIZE-1
add eax,I_END
mov [tail],eax
shr ebx,16
; dpd ebx
mov [max_block],ebx
xor eax,eax
mov ecx,256
mov edi,fileinfo.name
repne scasb
sub edi,fileinfo.name+1
mov [fname_size],edi
top_red:
mov [top],TOP
red: ; ¯¥à¥à¨á®¢ âì ®ª­®
 
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª­ 
 
;---------------------------------------------------------------------
;--- –ˆŠ‹ Ž€Ž’Šˆ ‘Ž›’ˆ‰ ----------------------------------------
;---------------------------------------------------------------------
 
still:
mcall 10 ; äã­ªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï
 
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª­® ?
je red ; ¥á«¨ ¤  - ­  ¬¥âªã red
cmp eax,3 ; ­ ¦ â  ª­®¯ª  ?
je button ; ¥á«¨ ¤  - ­  button
cmp eax,2 ; ­ ¦ â  ª« ¢¨è  ?
je key ; ¥á«¨ ¤  - ­  key
 
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
 
 
;---------------------------------------------------------------------
 
 
key: ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
mcall 2 ; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®«  (¢ ah)
cmp ah,104 ; HELP
jne .nohelp
.help:
xor [mode],RTF_HELP
test [mode],RTF_HELP
jz load_file
mov ecx,help_end-help_file
mov [block_end],ecx
add [block_end],I_END
mov [tail],ecx
add [tail],I_END
mov esi,help_file
mov edi,I_END
rep movsb
; or [mode],RTF_HELP
xor eax,eax
mov [max_block],eax
jmp top_red
.nohelp:
; test [mode],RTF_HELP
; jz .nohelp2
; and [mode],not RTF_HELP
; cmp dword[fileinfo.name],N_A
; je still
; jmp prep_load
.nohelp2:
cmp ah,114 ; R - redraw
je red
cmp ah,99 ; C - color
jne .nocolor
.color:
xor [mode],RTF_COLORLESS
jmp red
.nocolor:
cmp ah,97 ; A - alignment
jne .noalign
.alignment:
xor [mode],RTF_ALIGNLESS
jmp red
.noalign:
cmp ah,44 ; < - pitch dec
jne .nopd
.decp:
dec [pitch]
jmp red
.nopd:
cmp ah,46 ; < - pitch inc
jne .nopi
.incp:
inc [pitch]
jmp red
.nopi:
cmp ah,180 ; Home
je top_red
mov ebx,dword[prcinfo+46]
sub ebx,TOP+15
cmp ah,183 ;PgDn
jne .nopgdn
sub [top],bx
jmp red
.nopgdn:
cmp ah,177 ;arrDn
jne .noardn
sub [top],CHARH
jmp red
.noardn:
mov cx,[top]
cmp ah,184 ;PgUp
jne .nopgup
add [top],bx
cmp [top],TOP
jl red
mov [top],TOP
cmp cx,[top]
je still
jmp red
.nopgup:
cmp ah,178 ;arrUp
jne .noarup
add [top],CHARH
cmp [top],TOP
jl red
mov [top],TOP
cmp cx,[top]
je still
jmp red
.noarup:
if RENDER eq FREE
cmp ah,56 ;zoom+
jne .noplus
.zplus:
fld [FreeFontscale]
fmul [Zoomscale]
.zoom:
fstp [FreeFontscale]
jmp red
.noplus:
cmp ah,54 ;zoom-
jne .nominus
.zminus:
fld [FreeFontscale]
fdiv [Zoomscale]
jmp .zoom
.nominus:
end if
cmp ah,108 ; L - load
jne stilld
.file_open:
or [mode],RTF_OPENING
opendialog draw_window, prep_load, st_1, fname_buf
st_1:
and [mode],not RTF_OPENING
jmp still;red
stilld:
jmp still
 
;---------------------------------------------------------------------
 
button:
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
cmp ah,2
je key.help
cmp ah,3
je key.color
cmp ah,4
je key.alignment
cmp ah,5
je key.file_open
cmp ah,6
je key.incp
cmp ah,7
je key.decp
if RENDER eq FREE
cmp ah,8
je key.zminus
cmp ah,9
je key.zplus
end if
cmp ah, 1 ; ¥á«¨ … ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
jne .noexit ; ¢¥à­ãâìáï
 
.exit:
mcall -1 ; ¨­ ç¥ ª®­¥æ ¯à®£à ¬¬ë
.noexit:
cmp ah,20
jne still
mcall 37,1
and eax,0xffff
cmp eax,[HClick]
je still
mov [HClick],eax
sub eax,25
mul [HDoc]
mov ebx,dword[prcinfo+46]
sub ebx,25
div ebx
dpd eax
mov [top],TOP
sub [top],ax
dps 'B'
jmp red;still
;---------------------------------------------------------------------
;--- Ž…„…‹…ˆ… ˆ Ž’ˆ‘Ž‚Š€ ŽŠ€ ----------------------------------
;---------------------------------------------------------------------
 
draw_window:
 
mcall 12, 1 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
; 1 - ­ ç¨­ ¥¬ à¨á®¢ âì
mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x805080D0, 0x005080D0
mcall 9,procinfo,-1
mov eax,[procinfo.x_size]
cmp eax,1
ja .temp12345
ret
.temp12345:
 
mcall 4, <8,8>, 0x10DDEEFF, header, headersize-header
mov esi,ecx
mcall 47,0x30000,isymImplemented,<114,8>
add edx,36 shl 16
mcall ,,isymMax
add edx,40 shl 16
mov esi,0x104e00e7;0x10f27840
cmp dword[fileinfo.name],N_A
jne .noNA
mov esi,0x10ff0000
.noNA:
mcall 4,edx,esi,fileinfo.name,[fname_size]
mov edi,prcinfo
mcall 9,edi,-1
and [mode],not RTF_TOEOF
mov ebx,[edi+42]
cmp ebx,[wSave]
je .nochg
.chg:
mov [wSave],ebx
or [mode],RTF_TOEOF
and [HDoc],0
and [line_count],0
mov [HClick],-100
.nochg:
sub ebx,60
shl ebx,16
mov bx,12
mov ecx,5 shl 16+12
mov esi,0xb810e7
mov edx,2
BTN_SPACE equ 14 shl 16
mcall 8 ;2
sub ebx,BTN_SPACE
inc edx
mcall 8,,,,0x459a ;3
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x107a30 ;4
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0xcc0000 ;5
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x575f8c ;6
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x575f8c ;7
if RENDER eq FREE
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x6a73d0 ;8
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0xd048c8 ;9
end if
shr ecx,16
mov bx,cx
add ebx,3 shl 16+3
mcall 4,,0x10ddeeff,btn_text,btn_end-btn_text
sub dword[prcinfo+42],LMARGIN
sub dword[prcinfo+46],CHARH
if GUTTER eq 1
mov ebx,LMARGIN shl 16+20
mov ecx,20
mov eax,4
mov edx,arrow
mov esi,1
.loop1:
push ecx
mcall ,,0xff0000
pop ecx
add ebx,50 shl 16
loop .loop1
end if
mov ebx,dword[prcinfo+42]
shl ebx,16
add ebx,7 shl 16+7
mov ecx,dword[prcinfo+46]
add ecx,25 shl 16-25
mov edx,20+1 shl 29
mcall 8
mov ecx,[HClick]
shl ecx,16
add ecx,6-3 shl 16
mcall 13,,,0xe26830
if MODE eq RTF
test [mode],RTF_OPENING
jne .ex
and [mode],not (RTF_BOTTOM);+RTF_TOEOF)
mov [colorptr],colortbl
mov eax,DEFCOLOR
mov edi,colortbl
mov ecx,16
rep stosd
xor eax,eax
mov [cGroup],eax
mov edi,Chp
mov ecx,SIZE_save
rep stosb
mov ax,[top]
mov word[Free+6],10
mov word[Free+4],ax
mov esi,I_END
call RtfParse
dpd eax
dps 'Lines='
mov eax,[line_count]
dpd eax
newline
; movzx eax,word[Free+4]
; dpd eax
mov eax,dword[prcinfo+42]
mov edx,WIN_COLOR
call draw_progress
if BENCH eq 1
mcall 26,9
sub eax,[bench]
dps <13,10,'Bench='>
dpd eax
end if
else
mov [char],0
mov ebx,10 shl 16+TOP
mov ecx,16
.l0:
push ecx
mov ecx,16
.l1:
push ecx
if RENDER eq BGI
mov edx,char
mov ecx,0x48000000
mov esi,1
BGIfont_Outtext
else
mcall 4,,0x10000000,char,1
end if
pop ecx
inc [char]
add ebx,(CHARW+3) shl 16
loop .l1
pop ecx
add ebx,CHARH+2
and ebx,0x0000ffff
add ebx,10 shl 16
loop .l0
end if
.ex:
mcall 12, 2 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
; 2, § ª®­ç¨«¨ à¨á®¢ âì
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
 
if GUTTER eq 1
arrow db 0x19
end if
;---------------------------------------------------------------------
;--- „€›… Žƒ€ŒŒ› ----------------------------------------------
;---------------------------------------------------------------------
 
; ¨­â¥àä¥©á ¯à®£à ¬¬ë ¬­®£®ï§ëç­ë©
; ‚ë ¬®¦¥â¥ § ¤ âì ï§ëª ¢ MACROS.INC (lang fix ï§ëª)
procinfo process_information
header:
db 'RTF READER v1. ( ):'
headersize:
btn_text:
if RENDER eq FREE
db '+ - '
end if
db '< > L A C H'
btn_end:
 
fileinfo:
dd 0
.block:
dd 0
.size dd 1
dd I_END
dd sys_mem
.name:
; db '//'
; db ' /HD/1/RTF/texts/FASM.TXT',0
; db '/HD/1/RTF/TEST2.RTF',0
; db '/HD/1/RTF/texts/index_ru.RTF',0
; db '/HD/1/RTF/texts/stas.RTF',0
; db '/HD/1/RTF/texts/zed.RTF',0
; db '/HD/1/RTF/PRACT.RTF',0
; db '/HD/1/RTF/SETUP2.RTF',0
; db '/HD/1/RTF/texts/TC_RU.RTF',0
; db '/HD/1/RTF/texts/WORD.RTF',0
; db '/HD/1/RTF/texts/WORD97.RTF',0
; db '/HD/1/RTF/texts/MASTAPP.RTF',0
; db '/HD/1/RTF/texts/1c_tor77.RTF',0
; db '/HD/1/RTF/texts/RELATION.RTF',0
; db '/HD/1/RTF/texts/PLANETS.RTF',0
; db '/HD/1/RTF/texts/LOTRRUS.RTF',0
db '/HD/1/RTF/texts/RULEBOOK.RTF',0
; db '/HD/1/RTF/texts/RULEBK2.RTF',0
; db '/HD/1/RTF/texts/GLEB.RTF',0
; db '/HD/1/RTF/texts/DWG13_14.RTF',0
; db '/HD/1/RTF/texts/LK.RTF',0
 
; db '/HD/1/RTF/texts/JUSTIFY.RTF',0
rb 256-($-.name)
;---------------------------------------------------------------------
;blind db ?
if RENDER eq PIX
; rd 2
Free rd 9
else
if RENDER eq BGI
FreeFontscale dd 0.07
else
Zoomscale dd 1.15
FreeFontscale dd 0.04
end if
Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0
end if
I_END0:
if BENCH eq 1
bench dd ?
end if
tail dd ?
cGroup dd ?
Chp:
CHP
Pap:
PAP
Sep:
SEP
Dop:
DOP
rds db ?
ris db ?
cbBin dd ?
lParam dd ?
fSkipDestIfUnk db ?
mode dd ?
curheight dw ?
maxheight dw ?
RetroBlock dd ?
RetroSave:
SAVE
prcinfo rb 1024
RetroPtr dd ?
colorptr dd ?
colortbl rd 16
ct_end:
fname_size dd ?
max_block dd ?
cur_block dd ?
HDoc dd ?
HClick dd ?
top dw ?
line_count dd ?
par_count dd ?
char db ?
pitch db ?
wSave dd ?
RetroXY dd ?
RetroGroup dd ?
 
save_stack:
rb RTFSTACKSIZE
save_limit:
rb BGIFONTSIZE
fname_buf rd 16
 
listptr dd ?
szKeyword rb 31
szParameter rb 21
block_end dd ?
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
rb RTFSIZE
esp1:
rb ESPSIZE
sys_mem:
rb ESPSIZE
esp_end:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/rtfread/trunk/rtftype.inc
0,0 → 1,374
macro Return _result
{
mov eax,_result
jmp .__ex
}
 
macro Epilog
{
.__ex:
mov [esp+28],eax
popa
ret
}
 
macro isdigit _reg, lbl_fail
{
cmp _reg,'0'
jb lbl_fail
cmp _reg,'9'
ja lbl_fail
}
 
macro islower _reg, lbl_fail
{
cmp _reg,'a'
jb lbl_fail
cmp _reg,'z'
ja lbl_fail
}
 
macro isalpha _reg, lbl_fail
{
local .ok
cmp _reg,'A'
jb lbl_fail
cmp _reg,'Z'
jbe .ok
islower _reg, lbl_fail
.ok:
}
 
macro dump _ptr, _len
{
if DEBUG_BLOCK eq 1
pusha
lea edx,[_ptr]
dps 'Dump at '
dpd edx
newline
mov eax,0x0d0a
xchg eax,[edx+_len]
pusha
call debug_outstr
popa
mov [edx+_len],eax
mcall 10
mcall 2
popa
end if
}
 
macro lods_block
{
local .noeof,.eof,.lod,.nog
.lod:
lodsb
cmp esi,[block_end]
jb .noeof
dump esi-20,20
mov esi,[cur_block]
cmp esi,[max_block]
jae .eof
if DEBUG_BLOCK eq 1
pusha
mcall 4,[Free+4],0xff0000,sym,1
popa
; dps 'Block='
; dpd esi
end if
call read_next_block
; test [mode],RTF_TOEOF
; jz .nog
test [mode],RTF_BLIND
jne .nog
mov eax,dword[prcinfo+42]
mul [cur_block]
div [max_block]
mov edx,0xff0000
call draw_progress
.nog:
dump esi,20
jmp .noeof;lod
.eof:
mov eax,ecOK;ecEndOfFile
jmp .__ex
.noeof:
}
 
macro RetError routine, route
{
call routine
test eax,eax
if route eq
je .getc
else
je route
end if
Return eax
}
 
macro Prcheck _prop
{
local .no
cmp ch, prop#_prop
jne .no
mov esi, _prop
jmp .checked
.no:
}
 
macro MemSet _prop,_struc
{
local .no
cmp al,_prop
jne .no
mov ecx,SIZE_#_struc
mov edi, _struc
jmp .ms
.no:
}
 
macro atoi
{
; in: esi->pasParameter
; out: eax->long
local .nxt
push ebx ecx
xor eax,eax
xor ebx,ebx
movzx ecx,byte[esi]
inc esi
.nxt:
lodsb
sub eax,'0'
imul ebx,10
add ebx,eax
loop .nxt
mov eax,ebx
pop ecx ebx
}
 
macro uc2oem
{
local .ex1
push edi
mov ecx,(oemutbl-uctbl)/2+1
mov edi,uctbl
repne scasw
jne .ex1
sub edi,uctbl
shr edi,1
dec edi
mov al,[oemutbl+edi]
.ex1:
pop edi
}
 
macro ansi2oem
{
local .ex2,.notintbl
push edi ecx
mov ecx,oematbl-ansitbl
mov edi,ansitbl
repne scasb
jne .notintbl
dec edi
mov al,[oematbl-ansitbl+edi]
jmp .ex2
.notintbl:
cmp al,0xc0
jb .ex2
sub al,0x40
cmp al,0xb0
jb .ex2
add al,0x30
.ex2:
pop ecx edi
}
 
draw_progress:
lea ebx,[eax+05 shl 16]
mov ecx,dword[prcinfo+46]
shl ecx,16
add ecx,2+5 shl 16
mcall 13
ret
 
fTrue equ 1
fFalse equ 0
 
macro CHP ; CHaracter Properties
{
db ?;fBold; 0
db ?;fUnderline; 1
db ?;fItalic; 2
db ?;fColor 3
db ?;fFont 4
dd ?;fFontSize 5
}
SIZE_Chp equ 9
 
macro PAP ; PAragraph Properties
{
dd ?;xaLeft; ; left indent in twips 0
dd ?;xaRight; ; right indent in twips 4
dd ?;xaFirst; ; first line indent in twips 8
db ?; just; ; justification 12
}
SIZE_Pap equ 13
 
macro SEP
{
dd ?;cCols; ; number of columns 0
db ?;sbk; ; section break type 4
dd ?;xaPgn; ; x position of page number in twips 5
dd ?;yaPgn; ; y position of page number in twips 9
db ?;pgnFormat; ; how the page number is formatted 13
} ; SEction Properties
SIZE_Sep equ 14
 
macro DOP
{
dd ?;xaPage; ; page width in twips 0
dd ?;yaPage; ; page height in twips 4
dd ?;xaLeft; ; left margin in twips 8
dd ?;yaTop; ; top margin in twips 12
dd ?;xaRight; ; right margin in twips 16
dd ?;yaBottom; ; bottom margin in twips 20
dd ?;pgnStart; ; starting page number in twips 24
db ?;fFacingp; ; facing pages enabled? 28
db ?;fLandscape; ; landscape or portrait?? 29
} ; ; DOcument Properties
SIZE_Dop equ 30
 
justL equ 0
justF equ 1
justR equ 2
justC equ 3
 
sbkNon equ 0
sbkCol equ 1
sbkEvn equ 2
sbkOdd equ 3
sbkPg equ 4
 
pgDec equ 0
pgURom equ 1
pgLRom equ 2
pgULtr equ 3
pgLLtr equ 4
 
rdsNorm equ 0
rdsSkip equ 1 ; Rtf Destination State
rdsColor equ 2
 
risNorm equ 0
risBin equ 1
risHex equ 2 ; Rtf Internal State
 
macro SAVE ; property save macrostructure
{
CHP ;chp; 0
PAP ;pap; 9
SEP ;sep; 22
DOP ;dop; 36
RDS db ?;rds; 66
RIS db ?;ris; 67
}
SIZE_save equ (SIZE_Chp+SIZE_Pap+SIZE_Sep+SIZE_Dop+2)
 
; What types of properties are there?
ipropBold equ 0
ipropItalic equ 1
ipropUnderline equ 2
ipropLeftInd equ 3
ipropRightInd equ 4
ipropFirstInd equ 5
ipropCols equ 6
ipropPgnX equ 7
ipropPgnY equ 8
ipropXaPage equ 9
ipropYaPage equ 10
ipropXaLeft equ 11
ipropXaRight equ 12
ipropYaTop equ 13
ipropYaBottom equ 14
ipropPgnStart equ 15
ipropSbk equ 16
ipropPgnFormat equ 17
ipropFacingp equ 18
ipropLandscape equ 19
ipropJust equ 20
ipropPard equ 21
ipropPlain equ 22
ipropSectd equ 23
ipropForeColor equ 24
ipropFont equ 25
ipropFontSize equ 26
ipropMax equ 27
 
 
actnSpec equ 0
actnByte equ 1
actnWord equ 2
actnFloatFS equ 3
 
propChp equ 0
propPap equ 1
propSep equ 2
propDop equ 3
 
macro PROP _actn,_prop,_offset
{
db _actn; 0 ; size of value
db _prop; 1 ; macrostructure containing value
db _offset; 2 ; offset of value from base of macrostructure
}
PROP_SIZE equ 3
 
ipfnBin equ 0
ipfnHex equ 1
ipfnSkipDest equ 2
 
idestPict equ 0
idestSkip equ 1
idestColor equ 2
 
kwdChar equ 0
kwdDest equ 1
kwdProp equ 2
kwdSpec equ 3
kwdColor equ 4
kwdUC equ 5
 
isymMax =0
isymImplemented=0
macro SYM _szKeyword,_dflt,_fPassDflt,_kwd,_idx,_impl
{
local .r
if _impl eq 1
isymImplemented=isymImplemented+1
end if
dw _dflt; 0 ; default value to use
db _fPassDflt; 2 ; true to use default value from this table
db _kwd; 3 ; base action to take
db _idx; 4 ; index into property table if kwd == kwdProp
; index into destination table if kwd == kwdDest
; character to print if kwd == kwdChar
db .r-$-1 ; 5
db _szKeyword; ; RTF keyword
.r:
isymMax=isymMax+1
}
; RTF parser error codes
 
ecOK equ 0 ; Everything's fine!
ecStackUnderflow equ 1 ; Unmatched '}'
ecStackOverflow equ 2 ; Too many '{' -- memory exhausted
ecUnmatchedBrace equ 3 ; RTF ended during an open group.
ecInvalidHex equ 4 ; invalid hex character found in data
ecBadTable equ 5 ; RTF table (sym or prop) invalid
ecAssertion equ 6 ; Assertion failure
ecEndOfFile equ 7 ; End of file reached while reading RTF
ecOutOfWindow equ 8 ; Decoding interrupted after window edge
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/run/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm run.asm run
@pause
/programs/run/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm run.asm run
@pause
/programs/run/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/run/trunk/run.asm
0,0 → 1,198
; <--- description --->
; compiler: FASM 1.54
; name: MenuetOS RUN
; version: 0.02
; last update: 28/09/2004
; written by: Ivan Poddubny
; e-mail: ivan-yar@bk.ru
 
 
; <--- include all MeOS stuff --->
include "lang.inc"
include "macros.inc"
;;;lang fix en
 
 
; <--- start of MenuetOS application --->
MEOS_APP_START
 
;include "DEBUG.INC"
 
; <--- start of code --->
CODE
call draw_window ; at first create and draw the window
 
wait_event: ; main cycle
mcall 10
 
cmp eax, 1 ; if event == 1
je redraw ; jump to redraw handler
cmp eax, 2 ; else if event == 2
je key ; jump to key handler
cmp eax, 3 ; else if event == 3
je button ; jump to button handler
 
jmp wait_event ; else return to the start of main cycle
 
 
redraw: ; redraw event handler
call draw_window
jmp wait_event
 
 
key: ; key event handler
mcall 2
 
cmp ah, 13
je _run
cmp ah, 8
je .backspace
 
mov bl, ah
mov eax, [position]
mov [filename + eax], bl
inc [position]
call draw_string
 
jmp wait_event
 
.backspace:
xor eax, eax
cmp [position], eax
je wait_event
dec [position]
call draw_string
jmp wait_event
 
 
button: ; button event handler
mcall 17
 
cmp ah, 10
je _run
 
dec ah
jne wait_event ; return if button id != 1
 
_exit:
or eax, -1 ; exit application
int 0x40
 
 
_run:
mcall 58, fileinfo
; dps "58th function returned "
; dpd eax
; newline
jmp _exit
 
 
draw_window:
mcall 12, 1
 
mcall 14
and eax, 0xFFFF
sub eax, 100
shl eax, 16
add eax, 80
mov ecx, eax
 
mov ebx, 148*65536+400 ; (window_cx)*65536+(window_sx)
mov edx, 0x03DDDDDD ; work area color & window type 3
mcall 0
 
mov ebx, 8*65536+8 ; coordinates
mov ecx, 0x10ffffff ; color & font N1
mov edx, header ; address of text
mov esi, header.size ; length of text
mcall 4
 
mpack ebx, 10, 26
mov ecx, 0
mov edx, message
mov esi, message.size
mcall
 
mpack ebx, 385-(runbtn.size*6), runbtn.size*6+4
mpack ecx, 56, 14
mov edx, 10
mov esi, 0xa0a0a0
mcall 8
 
; mpack ebx, 385-runbtn.size*6-findbtn.size*6-8, findbtn.size*6+4
; inc edx
; mcall 8
 
; mpack ebx, 388-runbtn.size*6-findbtn.size*6-7, 59
; mov ecx, 0
; mov edx, findbtn
; mov esi, findbtn.size
; mcall 4
 
mpack ebx, 388-runbtn.size*6, 59
mov ecx, 0
mov edx, runbtn
mov esi, runbtn.size
mcall 4
 
call draw_string
 
mcall 12, 2
ret
 
 
draw_string:
mpack ebx, 10, 380
mpack ecx, 38, 14
mov edx, 0xA0A0A0
mcall 13
 
mpack ebx, 14, 41
mov ecx, 0
mov edx, filename
mov esi, [position]
mcall 4
ret
 
 
 
; <--- initialised data --->
DATA
 
position dd filename.size
 
lsz header,\
ru, "‡ ¯ã᪠¯à®£à ¬¬ë",\
en, "Start program"
 
lsz message,\
ru, "‚¢¥¤¨â¥ ¯ãâì ª ä ©«ã:",\
en, "Enter path to file:"
 
; lsz findbtn,\
; ru, " ©â¨...",\
; en, "Find..."
 
lsz runbtn,\
ru, "‡ ¯ãáâ¨âì",\
en, "Run"
 
 
fileinfo:
.mode dd 16
dd 0
.param dd 0
dd 0
.workarea dd workarea
 
sz filename, "/rd/1/"
rb 122
 
 
; <--- uninitialised data --->
UDATA
workarea rb 4096
 
 
MEOS_APP_END
; <--- end of MenuetOS application --->
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sb/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm sb.asm sb
@pause
/programs/sb/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm sb.asm sb
@pause
/programs/sb/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sb/trunk/sb.asm
0,0 → 1,1010
;
; SOUND BLASTER
;
; Compile with FASM for Menuet
;
 
include 'lang.inc'
include 'macros.inc'
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01
dd START ; program start
dd I_END ; program image size
dd 0x80000 ; required amount of memory
dd 0xfff0 ; stack position
dd 0,0
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
vol_data dd 0x40000
playposition dd 0x20000
next_tic dd 0x0
onoff dd 0x0
pause_between_songs dd 100
delay dd 100
repeat_song db 0
mono_stereo dd 1
 
 
; 0x10000 data from hd
; 0x20000 play position for sb
; 0x40000 volume indicator data
 
 
START: ; start of execution
 
call draw_window ; at first, draw the window
 
mov eax,26
mov ebx,9
int 0x40
mov [next_tic],eax
 
still:
 
mov [delay],145
cmp [mono_stereo],2
jne no_stereo
mov [delay],73
no_stereo:
 
mov eax,55
mov ebx,2
mov ecx,0
mov edx,[mono_stereo]
int 0x40
 
mov eax,23 ; wait here for event
mov ebx,1
int 0x40
 
cmp eax,0
jne do_task
 
still2:
 
cmp [onoff],0
je still
 
mov eax,26
mov ebx,9
int 0x40
mov ebx,[next_tic]
cmp eax,ebx
jge play_wave_block
 
mov edi,[next_tic]
sub edi,eax
mov eax,[delay]
sub eax,edi
mov edi,eax
call draw_volume
 
jmp still
 
do_task:
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
cmp eax,16+4
jne no_irman
mov eax,42
mov ebx,4
int 0x40
dec [ir_count]
cmp bl,140
jne no_first
mov [ir_count],3
no_first:
cmp [ir_count],0
jne no_irman
call give_wav
cmp bl,215
je play
mov ah,4
;; cmp bl,55
;; je rev
mov ah,3
;;; cmp bl,183
;;; je rev
cmp bl,127
jne no_block_dec
add [block],65536/512*10
no_block_dec:
cmp bl,191
jne no_block_inc
sub [block],65536/512*10
no_block_inc:
jmp still
no_irman:
 
jmp still
 
play_wave_block:
 
mov eax,55 ; load wave
mov ebx,0
mov ecx,[playposition]
int 0x40
 
mov eax,55 ; play wave
mov ebx,1
int 0x40
 
mov eax,26
mov ebx,9
int 0x40
add eax,[delay]
mov [next_tic],eax
 
call draw_wave
call read_wav
 
jmp still
 
red: ; redraw
call draw_window
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
jmp still2
 
button: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,6
jne no_ir
call enable_ir
jmp still
no_ir:
 
cmp ah,7
jne no_file_name
call read_string
jmp still
no_file_name:
 
cmp ah,2 ; button id=2
jne noplay
play:
mov eax,[onoff]
not eax
and eax,1
mov [onoff],eax
mov [playposition],0x20000
mov [block],2
call read_header
call read_wav
; mov [next_tic],0
jmp still
 
noplay:
 
cmp ah,3
jb no_rev
cmp ah,4
jg no_rev
sub ah,3
shr eax,8
imul eax,4000
sub eax,2000
add [block],eax
cmp [block],0x0f000000
jb block_ok
mov [block],2
block_ok:
call display_progress
jmp still2
no_rev:
 
cmp ah,5 ; repeat song ?
jne no_repeat
mov al,[repeat_song]
inc al
and eax,1
mov [repeat_song],al
shl eax,2
mov eax,[repeat_text+eax]
mov [text+40*5+31],eax
call draw_window
jmp still
repeat_text: db 'OFF ON '
no_repeat:
 
 
cmp ah,1
jne noclose
cmp [infrared_enabled],1
jne no_dis
mov eax,45
mov ebx,1
mov ecx,4
int 0x40
mov eax,46
mov ebx,1
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
no_dis:
mov eax,-1 ; close this program
int 0x40
noclose:
 
jmp still2
 
 
give_wav:
 
pusha
 
mov eax,55
mov ebx,0
mov ecx,0x20000
int 0x40
 
popa
ret
 
ir_count db 0x0
 
 
drop_rate dd 100
 
draw_volume:
 
; edi = tic to show
 
ret
 
pusha
 
add edi,[vol_data]
 
mov eax,[drop_rate]
cmp eax,2
jb no_drop
sub eax,2
no_drop:
mov [drop_rate],eax
 
movzx eax,byte [edi]
cmp eax,[drop_rate]
jge drop_ok
mov eax,[drop_rate]
mov [edi],al
jmp fixed_drop
drop_ok:
mov [drop_rate],eax
fixed_drop:
 
mov eax,13
mov ebx,320*65536+20
mov ecx,50*65536+1
movzx edx,byte [edi]
shr edx,1
mov esi,128
sub esi,edx
add ecx,esi
mov edx,0x00ff00
int 0x40
 
mov eax,13
mov ebx,320*65536+20
movzx edx,byte [edi]
shr edx,1
mov ecx,edx
add ecx,(50+128)*65536+1
shl edx,16
sub ecx,edx
mov edx,0xff0000
int 0x40
 
popa
 
ret
 
 
read_header:
 
pusha
 
mov dword [file_info+4],0 ; block to read
mov dword [file_info+8],1 ; blocks to read
mov dword [file_info+12],0x10000+1024 ; return data pointer
mov dword [file_info+16],0x60000 ; work area for os
 
mov eax,58
mov ebx,file_info
int 0x40
 
movzx eax,byte [0x10000+1024+12+10]
mov [channels],eax
movzx eax,byte [0x10000+1024+12+20]
mov [bytes_per_sample],eax
 
cmp [0x10000+1024],dword 'RIFF'
jne unknownformat
cmp [0x10000+1024+8],dword 'WAVE'
jne unknownformat
 
mov [addb],128
cmp [channels],1
je addb_ok
mov [addb],256
addb_ok:
cmp [bytes_per_sample],1
je addb_ok2
mov [addb],256
addb_ok2:
 
mov [bmul],256
cmp [addb],256
je bmok
mov [bmul],512
bmok:
 
cmp [bytes_per_sample],4
jne no16s
mov [addb],512 ;mono_stereo
mov ecx,[mono_stereo]
shr ecx,1
shr [addb],cl
mov [bmul],128 ;mono_stereo
shl [bmul],cl
no16s:
 
popa
 
ret
 
unknownformat:
 
mov [onoff],0
 
call display_progress
 
mov eax,13
mov ebx,190*65536+10
mov ecx,104*65536+10
mov edx,0xff0000
int 0x40
pusha
 
mov eax,5
mov ebx,[pause_between_songs]
int 0x40
 
popa
mov eax,13
mov edx,0x000000
int 0x40
 
popa
 
ret
 
 
 
channels dd 0x0 ; 1=mono, 2 stereo
bytes_per_sample dd 0x0 ; 1=8 2=2*8/16 4=16
 
buffer dd 0x20000
 
block dd 0x2
addb dd 256 ; 128 = mono 8 bit , 256 = stereo 8 bit/16 bit mono
bmul dd 0x0 ; 512 = mono 8 bit , 256 = stereo 8 bit/16 bit mono
 
file_size dd 100
 
current_play dd wavfile+40*0
 
 
read_wav:
 
pusha
 
new_file:
 
mov edx,[block]
 
newread:
 
mov dword [file_info+4],edx ; block to read
mov dword [file_info+8],1 ; blocks to read
mov dword [file_info+12],0x10000+1024 ; return data pointer
mov dword [file_info+16],0x60000 ; work area for os
 
mov eax,58
mov ebx,file_info
int 0x40
 
 
pusha
mov eax,11
int 0x40
cmp eax,1
jne no_wd
call draw_window
no_wd:
popa
 
pusha
mov eax,38
mov ebx,1*65536+128
mov ecx,71*65536+71
add ebx,25*65536+25
mov edx,0x555555
; int 0x40
mov eax,38
mov ebx,[esp+32-12]
and ebx,65536/512 -1
or ebx,1*65536
add ebx,25*65536+25
mov ecx,71*65536+71
mov edx,0x999999
; int 0x40
popa
 
cmp eax,0
je conp
 
movzx eax,byte [repeat_song]
inc eax
and eax,1
imul eax,40
mov [current_play],wavfile
play_ok:
 
mov [onoff],1
mov [playposition],0x20000
mov [block],20
 
mov eax,5
mov ebx,[pause_between_songs]
add ebx,[delay]
int 0x40
 
call read_header
 
cmp [onoff],0
je noplay2
cmp [repeat_song],0
je noplay2
 
call display_progress
 
jmp new_file
 
noplay2:
 
mov [onoff],0
mov [block],2
call display_progress
 
popa
ret
conp:
 
mov [file_size],ebx
 
mov esi,0x10000+1024 ; 8 bit stereo & 16 bit mono
mov edi,edx
sub edi,[block]
imul edi,[bmul]
add edi,[buffer]
mov ecx,512
 
movedata:
 
mov al,[esi+1]
 
cmp [bytes_per_sample],4 ; for 16 bit stereo
jne no_16_stereo
mov al,[esi+1]
add al,128
no_16_stereo:
 
cmp [bytes_per_sample],1 ; for 16 bit mono
je no_16_mono
cmp [channels],2
je no_16_mono
mov al,[esi+1]
add al,128
no_16_mono:
 
mov [edi],al
mov eax,[bytes_per_sample]
cmp [mono_stereo],1
je bps1
mov eax,[bytes_per_sample]
push ecx
mov ecx,[mono_stereo]
dec ecx
shr eax,cl
pop ecx
bps1:
add esi,eax ; 2;[bytes_per_sample] ; / mono_stereo
add edi,1
loop movedata
 
add edx,1
mov ecx,[block]
add ecx,[addb]
cmp edx,ecx
jbe newread
 
mov ecx,[addb]
add [block],ecx
 
call display_progress
 
rewr:
 
popa
 
call set_vol_data
 
ret
 
 
set_vol_data:
 
; ret
 
pusha
 
mov eax,65536
xor edx,edx
mov ebx,[delay]
div ebx
push eax
 
mov esi,[playposition]
mov edi,[vol_data]
mov ecx,[delay]
 
svd:
 
mov eax,0
mov edx,100
svd3:
movzx ebx,byte [esi]
cmp ebx,128
jge svd2
mov ebx,0
svd2:
sub ebx,128
shl ebx,1
 
cmp ebx,ebp
jbe svd4
mov edx,ebx
svd4:
 
inc esi
inc eax
cmp eax,[esp]
jb svd3
 
mov [edi],dl
inc edi
loop svd
 
pop eax
popa
 
ret
 
 
addr dd 0x0
ya dd 0x0
 
 
read_string:
 
mov [onoff],0
 
mov [addr],wavfile
mov [ya],30
 
mov edi,[addr]
mov al,'_'
mov ecx,32
rep stosb
 
call print_text
 
mov edi,[addr]
 
f11:
mov eax,10
int 0x40
cmp eax,2
jne read_done
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je read_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
sub edi,1
mov [edi],byte '_'
call print_text
jmp f11
nobsl:
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
sub eax,32
keyok:
mov [edi],al
 
call print_text
 
add edi,1
mov esi,[addr]
add esi,32
cmp esi,edi
jnz f11
 
read_done:
 
mov ecx,[addr]
add ecx,38
sub ecx,edi
mov eax,0
cld
rep stosb
 
call print_text
 
ret
 
 
print_text:
 
display_progress:
 
pusha
 
mov eax,13 ; gray progress bar
mov ebx,25*65536+215
mov ecx,61*65536+8
mov edx,[border]
int 0x40
 
cmp [onoff],1
je yes_playing
mov [block],0
mov [file_size],100*512
yes_playing:
mov eax,[block] ; yellow progress bar
imul eax,214
xor edx,edx
mov ebx,[file_size]
shr ebx,9
or ebx,1
div ebx
mov ebx,eax
and ebx,0xff
mov eax,13
add ebx,25*65536
mov ecx,61*65536+1
mov edx,[drawp]
newbar:
int 0x40
add edx,0x101010
add ecx,1*65536
cmp ecx,65*65536
jb newbar
newbar2:
int 0x40
sub edx,0x101010
add ecx,1*65536
cmp ecx,69*65536
jb newbar2
 
 
mov eax,[block]
imul eax,214-30
xor edx,edx
mov ebx,[file_size]
shr ebx,9
or ebx,1
div ebx
mov ebx,eax
shl ebx,16
add ebx,25*65536+30
mov ecx,61*65536+9
mov edx,0xeeeeff
mov eax,13
mov edi,5
newb:
; int 0x40
add ebx,1*65536-2
add ecx,1*65536-2
sub edx,0x332211;3366aa
dec edi
jnz newb
 
 
noyellow:
 
mov esi,[current_play]
mov edi,now_playing
mov ecx,40
cld
rep movsb
 
mov eax,13
mov ebx,42*65536+33*6
mov ecx,114*65536+11
mov edx,0x000000
int 0x40
 
mov eax,4
mov ebx,42*65536+117
mov ecx,[textc]
mov edx,now_playing
mov esi,38
int 0x40
 
popa
 
ret
 
 
shape_window:
 
ret
 
pusha
 
mov eax,50
mov ebx,0
mov ecx,shape_reference
int 0x40
 
mov eax,50
mov ebx,1
mov ecx,4
int 0x40
 
popa
 
ret
 
 
shape_reference:
 
times 1 db 1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
times 9 db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
 
infrared_enabled db 0x0
 
 
enable_ir:
 
pusha
 
mov eax,46
mov ebx,0
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
 
mov eax,45
mov ebx,0
mov ecx,4
int 0x40
 
mov eax,40
mov ebx,10000b shl 16 + 111b
int 0x40
 
mov [infrared_enabled],1
 
popa
 
ret
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
pusha
 
inc [next_tic]
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+320 ; [x start] *65536 + [x size]
mov ecx,100*65536+140 ; [y start] *65536 + [y size]
mov edx,[bgr]
add edx,0x03000000 ; color of work area RRGGBB,8->color gl
mov esi,0x808844ee
mov edi,0x008844ee ; 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,0x10ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
mov eax,8 ; START/STOP - id 2
mov ebx,24*65536+77
mov ecx,80*65536+16
mov edx,2
mov esi,[border]
int 0x40
 
inc edx ; << / >> - id 3 , 4
add ebx,86*65536-57
mov eax,8
int 0x40
inc edx
add ebx,24*65536
mov eax,8
int 0x40
 
mov eax,8 ; REPEAT
add ebx,29*65536+54
inc edx
int 0x40
 
mov eax,8 ; enable infrared
add ebx,98*65536-33
add ecx,10*65536+10
inc edx
int 0x40
 
pusha
mov eax,8
mov ebx,25*65536+9
mov ecx,115*65536+9
inc edx
int 0x40
popa
 
mov eax,4
shr ecx,16
mov bx,cx
add ebx,2*65536+4
mov ecx,0xffffff
mov edx,infrared_text
mov esi,10
int 0x40
add ebx,11
add edx,10
mov eax,4
int 0x40
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,[textc]
mov edx,text
mov esi,40
newline:
mov eax,4
int 0x40
add ebx,10
add edx,40
cmp [edx],byte 'x'
jne newline
 
call display_progress
 
call draw_wave
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
 
 
draw_wave:
 
; ret
 
pusha
 
mov eax,13
mov ebx,260*65536+43
mov ecx,42*65536+32
mov edx,[border]
int 0x40
 
mov esi,[playposition]
mov ebx,260
npix:
mov eax,1
inc ebx
movzx ecx,byte [esi]
shr ecx,3
add ecx,42
mov edx,[drawc];0x2255aa
int 0x40
 
add esi,2
 
cmp ebx,300
jbe npix
 
popa
 
ret
 
 
; DATA AREA
 
infrared_text: db 'IRMAN INFRAR '
 
 
textc dd 0xffffff
bgr dd 0x00000000
drawc dd 0x2255aa
drawp dd 0x8011aa
border dd 0x5577aa
 
text:
db 'Define SB, HD & partition with setup '
db 'If clipping change "delay" in source '
db ' '
db ' '
db ' '
db ' START/STOP << >> REPEAT:OFF '
db 'x <- END MARKER, DONT DELETE '
now_playing:
db ' '
db 'xx '
 
file_info:
 
dd 0 ; read
dd 0
dd 0
dd 0
dd 0
 
wavfile:
db '/HD/1/MENUET/MUSIC/FILE7.WAV',0
db ' '
 
 
labelt:
db ' WAVE PLAYER : 8b Mono - 16b Stereo'
labellen:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/scancode/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm scancode.asm scancode
@pause
/programs/scancode/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm scancode.asm scancode
@pause
/programs/scancode/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/scancode/trunk/scancode.asm
0,0 → 1,336
;
; KEYBOARD SCANCODE EXAMPLE
;
; Compile with FASM for Menuet
;
 
include "lang.inc"
include "macros.inc"
 
use32
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x1000 ; memory for app
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
START: ; start of execution
 
mov eax,66 ; keyboard mode definitions
mov ebx,1 ; set
mov ecx,1 ; return scancodes
int 0x40
 
mov eax,26 ; get setup for keyboard
mov ebx,2
mov ecx,1 ; base keymap
mov edx,keymap
int 0x40
 
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 ; just read it and ignore
int 0x40
 
mov esi,scan_codes+1
mov edi,scan_codes+0
mov ecx,15
cld
rep movsb
 
mov esi,key_codes+12
mov edi,key_codes+0
mov ecx,15*12
cld
rep movsb
 
shr eax,8 ; scancode
and eax,0xff
mov [scan_codes+15],al
 
mov [key_codes+15*12+8],dword 'Down'
cmp eax,128
jb no_up
mov [key_codes+15*12+8],dword 'Up '
no_up:
 
mov ebx,eax
and ebx,0x7f
 
movzx edx,byte [keymap+ebx] ; key from keymap
mov [key_codes+15*12+0],edx
mov [key_codes+15*12+4],dword ' '
 
movzx edx,byte [ext]
shl edx,8
add ebx,edx
 
mov esi,ext0-10
new_ext0:
add esi,10
cmp esi,ext0end
jg exit_ext0
movzx edx,word [esi]
cmp edx,ebx
jne new_ext0
mov edx,[esi+2]
mov [key_codes+15*12+0],edx
mov edx,[esi+6]
mov [key_codes+15*12+4],edx
exit_ext0:
no_ext_off:
 
cmp [ext2],0
je noext2dec
dec [ext2]
jne noext2dec
mov [key_codes+15*12+0],dword '----'
mov [key_codes+15*12+4],dword '----'
noext2dec:
 
mov [ext],0
 
cmp eax,224
jne no_ext
mov [key_codes+15*12+0],dword ' '
mov [key_codes+15*12+4],dword ' '
mov [key_codes+15*12+8],dword 'Ext '
mov [ext],1
no_ext:
 
cmp eax,225
jne no_ext2
mov [key_codes+15*12+0],dword ' '
mov [key_codes+15*12+4],dword ' '
mov [key_codes+15*12+8],dword 'Ext2'
mov [ext],2
mov [ext2],2
no_ext2:
 
 
call draw_codes
jmp still
 
 
 
button: ; button
or eax, -1 ; close this program
int 0x40
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax, 48 ; GET SYSTEM COLORS
mov ebx, 3
mov ecx, sc
mov edx, sizeof.system_colors
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
mov eax, 0 ; function 0 : define and draw window
mov ebx, 100*65536+200 ; [x start] *65536 + [x size]
mov ecx, 100*65536+275 ; [y start] *65536 + [y size]
mov edx, [sc.work] ; color of work area RRGGBB,8->color gl
or edx, 0x03000000
mov esi, [sc.grab] ; color of grab bar RRGGBB,8->color gl
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] ; font 1 & color ( 0xF0RRGGBB )
or ecx, 0x10000000
mov edx, header ; pointer to text beginning
mov esi, header.len ; text length
int 0x40
 
mov eax, 4
mov ebx, 20*65536+35
mov ecx, 0
mov edx, text
mov esi, text.len
int 0x40
 
call draw_codes
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
draw_codes:
 
mov eax,47
mov ebx,6*65536
mov edx,20*65536+60
mov edi,0
mov esi,0
newscan:
pusha
mov cx,dx
shl ecx,16
add ecx,10
mov eax,13 ; filled rectangle
mov ebx,20*65536+160
mov edx,[sc.work]
int 0x40
popa
pusha
mov ebx,edx
add ebx,70*65536
mov eax,4 ; text
mov ecx,[sc.work_text]
mov edx,key_codes
imul edi,12
add edx,edi
mov esi,12
int 0x40
popa
movzx ecx,byte [scan_codes+edi]
int 0x40 ; number
inc ecx
add edx,12
inc edi
cmp edi,16
jne newscan
 
ret
 
 
; DATA AREA
 
ext0:
 
db 1,0,'Esc '
db 28,0,'Enter '
db 29,0,'L-Ctrl '
db 41,0,'1/2 '
db 42,0,'L-Shift '
db 54,0,'R-Shift '
db 55,0,'Num * '
db 56,0,'Alt '
db 58,0,'CapsLck '
db 59,0,'F1 '
db 60,0,'F2 '
db 61,0,'F3 '
db 62,0,'F4 '
db 63,0,'F5 '
db 64,0,'F6 '
db 65,0,'F7 '
db 66,0,'F8 '
db 67,0,'F9 '
db 68,0,'F10 '
db 69,0,'NumLock '
db 70,0,'SclLock '
db 71,0,'Num 7 '
db 72,0,'Num 8 '
db 73,0,'Num 9 '
db 74,0,'Num - '
db 75,0,'Num 4 '
db 76,0,'Num 5 '
db 77,0,'Num 6 '
db 78,0,'Num + '
db 79,0,'Num 1 '
db 80,0,'Num 2 '
db 81,0,'Num 3 '
db 82,0,'Num 0 '
db 83,0,'Num , '
db 87,0,'F11 '
db 88,0,'F12 '
 
db 28,1,'Num Ent '
db 29,1,'R-Ctrl '
db 53,1,'Num / '
db 55,1,'PrScr '
db 56,1,'Alt Gr '
db 71,1,'Home '
db 72,1,'Up-A '
db 73,1,'PgUp '
db 75,1,'Left-A '
db 77,1,'Right-A '
db 79,1,'End '
db 80,1,'Down-A '
db 81,1,'PgDown '
db 82,1,'Insert '
db 83,1,'Delete '
db 91,1,'Menu-1 '
db 92,1,'Menu-2 '
db 93,1,'Menu-3 '
 
db 29,2,'Break '
 
ext0end:
 
 
if lang eq ru
text:
db '‘—ˆ’›‚€ž „€›… ‘ Š‹€‚ˆ€’“›'
.len = $ - text
 
header:
db '‘Š€ŠŽ„› Š‹€‚ˆ€’“›'
.len = $ - header
else
text:
db 'READING RAW SCANCODE DATA'
.len = $ - text
 
header:
db 'KEYBOARD SCANCODES'
.len = $ - header
end if
 
ext db 0x0
ext2 db 0x0
 
pos dd 0x0
 
I_END:
 
sc system_colors
 
scan_codes: times 16 db ?
 
key_codes: times 16 dd ?,?,?
 
keymap:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/scrshot/trunk/ascl.inc
0,0 → 1,933
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 savefile file_name,file_save_area,file_temp_area,fsize
{
local save,fileinfo,string ;,counter00
jmp save
;counter00 dd 0
fileinfo:
dd 1
dd 0
dd fsize ;counter00
dd file_save_area
dd file_temp_area
string:
db file_name,0
save:
;xor edi,edi
; sub edi,file_save_area ; calculate dump size
; mov edx,edi
;mov [counter00],edi
; mov dword [fileinfo+8],1 ; how many blocks to write (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
words2reg ebx,arg1,arg3
words2reg ecx,arg2,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 putlabel 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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/scrshot/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm scrshot.asm scrshot
@pause
/programs/scrshot/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm scrshot.asm scrshot
@pause
/programs/scrshot/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/scrshot/trunk/readme.txt
0,0 → 1,26
 
ScrShoot v.0.1b - Ôîòîãðàô ýêðàíà (ScreenShooter)
Àëãîðèòì çàïèñè áìï-ôàéëà âçÿò èç VSCREEN2, îäíàêî,
ýòà ïðîãðàììà íèêàê íå ïðèòåíäóåò íà îòíîøåíèå ê íåé, êàê ê ñåðü¸çíîé ïðîãðàììå.
Êîãäà-òî äàâíî ÿ óæå ïûòàëñÿ ïåðåäåëàòü vscreen, ÷òîáû ìîæíî áûëî èçìåíÿòü èìÿ
ñîõðàíÿåìîãî ôàéëà, îäíàêî îí íå ïîëó÷èë ðàñïðîñòðîíåíèÿ (èççà êðèâîñòè êîäà íàâåðíîå :)).
ScrShoot - ìàëåíüêàÿ ïðîãðàììêà (êîòîðàÿ çàíèìàåò äîñòàòî÷íî ÌÍÎÃÎ îïåðàòèâû), êîòîðàÿ
ïðè íàæàòèè íà êëàâèøó PrintScreen ñîõðàíÿåò ñíèìîê ýêðàíà, àâòîìàòè÷åñêè èçìåíÿåò èìÿ ôàéëà,
÷òî ïîçâîëÿåò äåëàòü äî 99 ñíèìêîâ. Ïðîãðàììà íå èìååò GUI, ïîýòîìó äàþ "êðàòêîå îïèñàíèå"
 
- [Print Screen] - ñîõðàíèòü ñíèìîê ýêðàíà íà '/hd/1/SCREEN##.BMP', ãäå ## - íîìåð ñíèìêà.
- ëåâûé [Alt] + [Print Screen] - ñîõðàíèòü ñíèìîê ýêðàíà íà '/rd/1/SCREEN##.BMP',
ãäå ## - íîìåð ñíèìêà.
- [Scroll Lock] - âûõîä èç ïðîãðàììû.
 
Èçâåñòíî ÷òî:
- âî âðåìÿ íàæàòèÿ êëàâèø ScrShoot äîëæåí áûòü àêòèâíûì (êòî íå ïîíÿë - ù¸ëêàåò íà êíîïå
[SCRSHOOT] íà ïàíåëè.)
- îäíî èçîáðàæåíèå çàïèñûâàåòñÿ íà ÆÄ äî 3õ ñåêóíä äëÿ 800õ600 è äî 5 ñåê.
äëÿ 1024õ768, òî åñòü åñëè âåì íàäî ñäåëàòü êó÷ó ñêðèíîâ
íàæèìàéòå íà ïðèíò ñêðèí íå ÷àùå 1 ðàçà â 3-5 ñåêóíä.
- ðàçðåøåíèå ýêðàíà íå äîëæíî ïðåâûøàòü 1024õ768, òàê êàê òîãäà çàïèñü áìïøíèêà çàéì¸ò
öåëóþ âå÷íîñòü, è ïàìÿòè áóäåò æðàòü ìíîãîâàòî. (íó ÿ êîíå÷íî êðàñêè ñãóñòèë, íî ýòî
âñ¸ æå òàê)
 
Ñèëüíûõ ãëþêîâ ÿ íå çàìåòèë, íî åñëè ÷òî - archangel{at}mail.kz
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/scrshot/trunk/scrshot.asm
0,0 → 1,232
;===[includes]===;
include 'lang.inc'
include 'ascl.inc'
include 'macros.inc'
;===[header and etc.]===;
meos_app_start
;===[code:]===;
code
;---------------------------------------
;====== we want keyborad events ========
mov eax,40
mov ebx,00000000000000000000000000000010b
int 0x40
 
;====== wanna use keyboard scan codes ==
mov eax,66
mov ebx,1
mov ecx,1
int 0x40
 
;=======GET SCREEN SIZE=================
 
mov eax,14 ; get screen size
int 0x40
push eax
and eax,0x0000ffff
inc eax
mov [size_y],eax
pop eax
shr eax,16
inc eax
mov [size_x],eax
 
mov eax,[size_x]
shr eax,2
mov [cmp_ecx],eax
 
mov eax,[size_x]
xor edx,edx
mov ebx,3
mul ebx
mov [add_esi],eax
 
mov eax,[size_y]
shr eax,2
mov [cmp_edx],eax
 
mov eax,[size_y]
imul eax,[size_x]
imul eax,3
mov [i_size],eax
 
;=======================================
 
still:
mov eax,10
int 0x40
cmp eax,2
je key
jmp still
 
key:
mov eax,2
int 0x40
cmp ah,55 ;===print screen to hdd
je print_screen_hdd
cmp ah,84 ;===alt+prnt.screen = print screen to fdd
je print_screen_fdd
cmp ah,70 ;===lets make exit - scroll lock
je close_now
jmp still
 
close_now:
close
;==================================
;===save file to hdd===============
print_screen_hdd:
mov [savetofdd],0
call change_fname
call save_screen
jmp still
;===save file to fdd===============
print_screen_fdd:
mov [savetofdd],1
call change_fname
call save_screen
jmp still
;===change our file name ==========
change_fname:
cmp [bmp_name+7],'9'
jne addfname
cmp [bmp_name+6],'9'
je leavenow ;if name is > than 'screen99.bmp' then we do not change name
mov [bmp_name+7],'0'
add [bmp_name+6],0x1
jmp leavenow
addfname:
add [bmp_name+7],0x1
leavenow:
ret
;==================================
 
;============SAVE SCREEN===========
read_pixel:
pushad
 
mov esi,eax
mov eax,[size_x]
mul ebx
add eax,esi
 
xchg eax,ebx
mov eax,35
int 0x40
mov [esp+28],eax
 
popad
ret
 
save_screen:
 
pusha
 
; 1) READ SCREEN
mov edi,bmp_file_area+0x36 ;0x10036
 
mov eax,[size_y]
dec eax
mov [temp_y],eax
 
ynew:
 
xor eax,eax
mov [temp_x],eax
 
xnew:
 
mov eax,[temp_x]
mov ebx,[temp_y]
call read_pixel
 
mov [edi],eax
add edi,3
 
inc [temp_x]
 
mov eax,[size_x]
cmp [temp_x],eax
jb xnew
 
dec [temp_y]
 
cmp [temp_y],0
jge ynew
 
; 2) BMP HEADER
 
mov [bmp_file_area],word 'BM' ; bmp signature
mov eax,[i_size]
mov [bmp_file_area+34],eax ; image size
mov ebx,0x36
mov [bmp_file_area+10],ebx ; headers size
add eax,ebx
mov [bmp_file_area+2],eax ; file size
mov [bmp_file_area+14],dword 0x28
mov eax,[size_x]
mov [bmp_file_area+18],eax ; x size
mov eax,[size_y]
mov [bmp_file_area+22],eax ; y size
mov [bmp_file_area+26],word 1
mov [bmp_file_area+28],word 0x18 ; bpp = 24 = 0x18
 
; 3) SAVE FILE
cmp [savetofdd],1
je save_to_fdd
mov eax,56
mov ebx,bmp_name
mov edx,bmp_file_area
mov ecx,[i_size]
add ecx,0x36
mov esi,path
int 0x40
popa
ret
 
save_to_fdd:
mov eax,33;
mov ebx,bmp_name
mov ecx,bmp_file_area
mov edx,[i_size]
add edx,0x36
mov esi,0
int 0x40
popa
ret
 
 
;=======================================
 
;---------------------------------------
;===[DATA]===;
data
;---------------------------------------
bmp_name db 'SCREEN00BMP'
path db 0
 
i_size dd 0x1
 
m_x dd 100
m_y dd 100
 
cmp_ecx dd 0
add_esi dd 0
cmp_edx dd 0
 
savetofdd db 0
 
;===[uninitialised data]===;
udata
;---------------------------------------
 
temp_x dd ?
temp_y dd ?
 
size_x dd ?
size_y dd ?
 
bmp_file_area:
rb 0x250000
 
;the happy end
meos_app_end
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/setup/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm setup.asm setup
@pause
/programs/setup/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm setup.asm setup
@pause
/programs/setup/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/setup/trunk/setup.asm
0,0 → 1,1649
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; DEVICE SETUP ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; Authors: Ville - original version
; A. Ivushkin - autostart (w launcher)
; M. Lisovin - added many feauters (apply all, save all, set time...)
; I. Poddubny - fixed russian keymap
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte identifier
dd 0x01 ; header version
dd START ; pointer to program start
dd I_END ; size of image
dd 0x4000 ; reguired amount of memory
dd 0x4000 ; stack pointer (esp)
dd I_PARAM,0 ; parameters, reserved
include 'lang.inc'
include 'macros.inc'
;******************************************************************************
 
LLL equ (56+3)
BBB equ 25
 
;******************************************************************************
apply_all:
 
mov eax,6 ; load saved settings from SETUP.DAT
mov ebx,filename
xor ecx,ecx
or edx,-1
mov esi,keyboard
int 0x40
 
call _midibase ;1
call _sound_dma ;10
call _pci_acc ;12
call _sb16 ;4
call _wssp ;6
call _syslang ;5
call _keyboard ;2
 
call get_disk_info
cmp [cd],0
jne no_cd
call _cdbase ;3
no_cd:
cmp [hd],0
jne no_hd
call _lba_read ;11
call _hdbase ;7
call _f32p ;8
no_hd:
ret
;-------------------------------------------------------------------------------
get_disk_info:
mov [hd],1
mov [cd],1
mov [hdbase],0
mov [cdbase],0
mcall 18,11,1,table_area
 
ide_0:
mov al,[table_area+1]
shr al,6
cmp al,0
je ide_1
cmp al,01b
jnz ide_0_cd
mov [hdbase],1
mov [hd],0
jmp ide_1
 
ide_0_cd:
cmp al,10b
jnz ide_1
mov [cdbase],1
mov [cd],0
cmp [hd],0
je all_device
 
ide_1:
mov al,[table_area+1]
shl al,2
shr al,6
cmp al,0
je ide_2
cmp al,01b
jnz ide_1_cd
cmp [hd],0
je ide_11
mov [hdbase],2
mov [hd],0
ide_11:
cmp [cd],0
je all_device
jmp ide_2
 
ide_1_cd:
cmp al,10b
jnz ide_2
cmp [cd],0
je ide_11_cd
mov [cdbase],2
mov [cd],0
ide_11_cd:
cmp [hd],0
je all_device
 
ide_2:
mov al,[table_area+1]
shl al,4
shr al,6
cmp al,0
je ide_3
cmp al,01b
jnz ide_2_cd
cmp [hd],0
je ide_21
mov [hdbase],3
mov [hd],0
ide_21:
cmp [cd],0
je all_device
jmp ide_3
 
ide_2_cd:
cmp al,10b
jnz ide_3
cmp [cd],0
je ide_21_cd
mov [cdbase],3
mov [cd],0
ide_21_cd:
cmp [hd],0
je all_device
 
ide_3:
mov al,[table_area+1]
shl al,6
shr al,6
cmp al,0
je not_device
cmp al,01b
jnz ide_3_cd
cmp [hd],0
je ide_31
mov [hdbase],4
mov [hd],0
ide_31:
cmp [cd],0
jmp all_device
 
ide_3_cd:
cmp al,10b
jnz not_device
cmp [cd],0
je all_device
mov [cdbase],4
mov [cd],0
 
all_device:
not_device:
ret
 
hd db 0
cd db 0
;******************************************************************************
apply_all_and_exit:
call apply_all
jmp close
 
;******************************************************************************
set_language_and_exit:
mov eax,26
mov ebx,2
mov ecx,9
int 0x40
; cmp eax,5
; jne @f
; xor eax,eax
;@@: mov [keyboard],eax
cmp eax,1
je russian
xor eax,eax
set_lang_now:
mov [keyboard],eax
call _keyboard
jmp close
russian:
mov eax,3
jmp set_lang_now
 
set_syslanguage_and_exit:
mov eax,26
mov ebx,5
; mov ecx,9
int 0x40
cmp eax,4
jne temp ;@f
xor eax,eax
;@@: inc eax
temp: inc eax
mov [syslang],eax
call _syslang
jmp close
 
get_setup_values:
mcall 26,1
mov [midibase],eax
mcall 26,2,9
dec eax
mov [keyboard],eax
mcall 26,3
mov [cdbase],eax
mcall 26,4
mov [sb16],eax
mcall 26,5
mov [syslang],eax
mcall 26,6
cmp eax,0x530
jne s_wss_2
mov eax,1
jmp get_other
s_wss_2:
cmp eax,0x608
jne s_wss_3
mov eax,2
jmp get_other
s_wss_3:
cmp eax,0xe80
jne s_wss_4
mov eax,3
jmp get_other
s_wss_4:
mov eax,4
get_other:
mov [wss],eax
mcall 26,7
mov [hdbase],eax
mcall 26,8
mov [f32p],eax
mcall 26,10
mov [sound_dma],eax
mcall 26,11
mov [lba_read],eax
mcall 26,12
mov [pci_acc],eax
ret
 
;******************************************************************************
 
START:
cmp [I_PARAM], 'SLAN'
je set_syslanguage_and_exit
 
cmp [I_PARAM], 'LANG'
je set_language_and_exit
 
; mov eax,6 ; load saved settings from SETUP.DAT
; mov ebx,filename
; xor ecx,ecx
; or edx,-1
; mov esi,keyboard
; int 0x40
 
cmp [I_PARAM], 'BOOT'
je apply_all_and_exit
 
call loadtxt
call get_setup_values
red:
call draw_window
 
still:
 
cmp word [blinkpar],0
jne blinker
mov eax,29 ;get system date
int 0x40
cmp eax,[date]
je gettime
mov [date],eax
gettime:
mov eax,3 ;get system time
int 0x40
cmp ax,[time]
je sysevent
mov [time],ax
call drawtime
 
sysevent:
mov eax,23
mov ebx,8 ; wait here for event with timeout
int 0x40
 
cmp eax,1
jz red
cmp eax,2
jz key
cmp eax,3
jz button
 
jmp still
 
blinker:
cmp byte [count],6
jb noblink
btc dword [blinkpar],16
mov byte [count],0
call drawtime
noblink:
inc byte [count]
jmp sysevent
 
incdectime:
cmp byte [blinkpar],0
je still
mov esi,time
mov bl,0x23 ;border
cmp byte [blinkpar],1
je hours
mov bl,0x59 ;minutes
inc esi
hours:
mov al,byte [esi]
cmp ah,112
je dectime
cmp al,bl
je noinctime
inc al
daa
jmp incdectime1
noinctime:
xor al,al
incdectime1:
mov byte [esi],al
jmp still
dectime:
cmp al,0
je nodectime
dec al
das
jmp incdectime1
nodectime:
mov al,bl
jmp incdectime1
 
incdecdate:
cmp byte [blinkpar+1],0
je still
mov esi,date
mov bl,0 ;border of years
cmp byte [blinkpar+1],1
jne days
mov bl,0x12 ;months
inc esi
days:
cmp byte [blinkpar+1],2
jne nodays
mov bl,0x31
add esi,2
nodays:
mov al,byte [esi]
cmp ah,122
je decdate
cmp al,bl
je noincdate
inc al ;add al,1
daa
jmp incdecdate1
noincdate:
mov al,1
incdecdate1:
mov byte [esi],al
jmp still
decdate:
cmp al,1
je nodecdate
dec al
das
jmp incdecdate1
nodecdate:
mov al,bl
jmp incdecdate1
 
 
key:
;mov eax,2
int 0x40
cmp ah,27
jne still
mov dword [blinkpar],0
call drawtime
jmp still
 
button:
 
mov eax,17
int 0x40
 
cmp ah,112
je incdectime
cmp ah,113
je incdectime
cmp ah,122
je incdecdate
cmp ah,123
je incdecdate
cmp ah,111
jne noseltime
mov al, [blinkpar]
cmp al,2
jae seltime
inc al
jmp seltime1
seltime:
xor al,al
seltime1:
mov [blinkpar],al
call drawtime
jmp still
noseltime:
cmp ah,121
jne noseldate
mov al,byte [blinkpar+1]
cmp al,3
jae seldate
inc al
jmp seldate1
seldate:
xor al,al
seldate1:
mov [blinkpar+1],al
call drawtime
jmp still
noseldate:
cmp ah,99
jne nosaveall
mov eax,33
mov ebx,filename
mov ecx,keyboard
mov edx,48
xor esi,esi
int 0x40
call settime
mov dword [blinkpar],0
call drawtime
jmp still
nosaveall:
cmp ah,100
jne no_apply_all
call apply_all
jmp still
no_apply_all:
 
cmp ah,1 ; CLOSE APPLICATION
jne no_close
close:
or eax,-1
int 0x40
no_close:
 
cmp ah,11 ; SET MIDI BASE
jnz nosetbase1
call _midibase
nosetbase1:
cmp ah,12
jnz nomm
sub [midibase],2
call draw_infotext
nomm:
cmp ah,13
jnz nomp
add [midibase],2
call draw_infotext
nomp:
 
 
cmp ah,4 ; SET KEYBOARD
jnz nokm
mov eax,[keyboard]
test eax,eax
je downuplbl
dec eax
jmp nodownup
downuplbl:
mov eax,4
nodownup:
mov [keyboard],eax
call draw_infotext
nokm:
cmp ah,5
jnz nokp
mov eax,[keyboard]
cmp eax,4
je updownlbl
inc eax
jmp noupdown
updownlbl:
xor eax,eax
noupdown:
mov [keyboard],eax
call draw_infotext
nokp:
 
 
cmp ah,22 ; SET CD BASE
jnz nocm
mov eax,[cdbase]
sub eax,2
and eax,3
inc eax
mov [cdbase],eax
call draw_infotext
nocm:
cmp ah,23
jnz nocp
mov eax,[cdbase]
and eax,3
inc eax
mov [cdbase],eax
call draw_infotext
nocp:
cmp ah,21
jnz nocs
call _cdbase
nocs:
 
cmp ah,62 ; SET HD BASE
jnz hnocm
mov eax,[hdbase]
sub eax,2
and eax,3
inc eax
mov [hdbase],eax
call draw_infotext
hnocm:
cmp ah,63
jnz hnocp
mov eax,[hdbase]
and eax,3
inc eax
mov [hdbase],eax
call draw_infotext
hnocp:
cmp ah,61
jnz hnocs
call _hdbase
hnocs:
 
cmp ah,82 ; SET SOUND DMA
jne no_sdma_d
mov eax,[sound_dma]
dec eax
sdmal:
and eax,3
mov [sound_dma],eax
call draw_infotext
jmp still
no_sdma_d:
cmp ah,83
jne no_sdma_i
mov eax,[sound_dma]
inc eax
jmp sdmal
no_sdma_i:
cmp ah,81
jne no_set_sound_dma
call _sound_dma
jmp still
no_set_sound_dma:
 
cmp ah,92 ; SET LBA READ
jne no_lba_d
slbal:
btc [lba_read],0
call draw_infotext
jmp still
no_lba_d:
cmp ah,93
jne no_lba_i
jmp slbal
no_lba_i:
cmp ah,91
jne no_set_lba_read
call _lba_read
jmp still
no_set_lba_read:
 
 
cmp ah,102 ; SET PCI ACCESS
jne no_pci_d
pcip:
btc [pci_acc],0
call draw_infotext
jmp still
no_pci_d:
cmp ah,103
jne no_pci_i
jmp pcip
no_pci_i:
cmp ah,101
jne no_set_pci_acc
call _pci_acc
jmp still
no_set_pci_acc:
 
 
set_partition:
cmp ah,72 ; SET FAT32 PARTITION
jnz .nominus
mov eax,[f32p]
sub eax,2
; and eax,15 ; 3 - four partitions, 7 - eight p., 15 - sixteen, etc.
cmp eax,15
jb @f
mov eax,14
@@:
inc eax
mov [f32p],eax
call draw_infotext
.nominus:
cmp ah,73
jnz .noplus
mov eax,[f32p]
; and eax,15 ; 3 - four partitions, 7 - eight p., 15 - sixteen, etc.
cmp eax,15
jb @f
mov eax,0
@@:
inc eax
mov [f32p],eax
call draw_infotext
.noplus:
cmp ah,71
jnz .noapply
call _f32p
.noapply:
 
cmp ah,32 ; SET SOUND BLASTER 16 BASE
jnz nosbm
sub [sb16],2
call draw_infotext
nosbm:
cmp ah,33
jnz nosbp
add [sb16],2
call draw_infotext
nosbp:
cmp ah,31
jnz nosbs
call _sb16
nosbs:
 
cmp ah,52 ; SET WINDOWS SOUND SYSTEM BASE
jnz nowssm
mov eax,[wss]
sub eax,2
and eax,3
inc eax
mov [wss],eax
call draw_infotext
nowssm:
cmp ah,53
jnz nowssp
mov eax,[wss]
and eax,3
inc eax
mov [wss],eax
call draw_infotext
nowssp:
cmp ah,51
jnz nowsss
call _wssp
nowsss:
 
cmp ah,42 ; SET SYSTEM LANGUAGE BASE
jnz nosysm
mov eax,[syslang]
dec eax
jz still
mov [syslang],eax
call draw_infotext
nosysm:
cmp ah,43
jnz nosysp
mov eax,[syslang]
cmp eax,4
je nosysp
inc eax
mov [syslang],eax
call draw_infotext
nosysp:
cmp ah,41
jnz nosyss
call _syslang
call cleantxt
call loadtxt
call draw_window
call drawtime
nosyss:
 
cmp ah,3 ; SET KEYMAP
jne still
call _keyboard
jmp still
 
_keyboard:
cmp [keyboard],0
jnz nosetkeyle
mov eax,21 ; english
mov ebx,2
mov ecx,1
mov edx,en_keymap
int 0x40
mov eax,21
inc ecx
mov edx,en_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,1
int 0x40
call alt_gen
nosetkeyle:
cmp [keyboard],1
jnz nosetkeylfi
mov eax,21 ; finnish
mov ebx,2
mov ecx,1
mov edx,fi_keymap
int 0x40
mov eax,21
inc ecx
mov edx,fi_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,2
int 0x40
call alt_gen
nosetkeylfi:
cmp [keyboard],2
jnz nosetkeylge
mov eax,21 ; german
mov ebx,2
mov ecx,1
mov edx,ge_keymap
int 0x40
mov eax,21
inc ecx
mov edx,ge_keymap_shift
int 0x40
mov eax,21
mov ecx,9
mov edx,3
int 0x40
call alt_gen
nosetkeylge:
cmp [keyboard],3
jnz nosetkeylru
mov eax,21 ; russian
mov ebx,2
mov ecx,1
mov edx,ru_keymap
int 0x40
mov eax,21
inc ecx
mov edx,ru_keymap_shift
int 0x40
call alt_gen
mov eax,21
mov ecx,9
mov edx,4
int 0x40
nosetkeylru:
cmp [keyboard],4 ;french
jnz nosetkeylfr
mov eax,21
mov ebx,2
mov ecx,1
mov edx,fr_keymap
int 0x40
mov eax,21
inc ecx
mov edx,fr_keymap_shift
int 0x40
mov eax,21
inc ecx
mov edx,fr_keymap_alt_gr
int 0x40
mov eax,21
mov ecx,9
mov edx,5
int 0x40
nosetkeylfr:
ret
 
alt_gen:
mov eax,21
mov ecx,3
mov edx,alt_general
int 0x40
ret
 
 
 
draw_buttons:
 
pusha
 
shl ecx,16
add ecx,12
mov ebx,(350-50)*65536+46+BBB
 
mov eax,8
int 0x40
 
mov ebx,(350-79)*65536+9
inc edx
int 0x40
 
mov ebx,(350-67)*65536+9
inc edx
int 0x40
 
popa
ret
 
 
 
; ********************************************
; ******* WINDOW DEFINITIONS AND DRAW *******
; ********************************************
 
 
draw_window:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
xor eax,eax ; DRAW WINDOW
mov ebx,40*65536+355+BBB
mov ecx,40*65536+300
mov edx,0x82111199
mov esi,0x805588dd
mov edi,0x005588dd
int 0x40
 
mov eax,4
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,labelt
cmp [syslang],4
je ruslabel
add edx,20
ruslabel:
mov esi,26
int 0x40
 
mov eax,8 ; CLOSE BUTTON
mov ebx,(355+BBB-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x005588dd
int 0x40
; APPLY ALL
mov ebx,(350-79)*65536+100
mov ecx,251*65536+12
mov edx,100
int 0x40
add ecx,16*65536 ; SAVE ALL
dec edx
int 0x40
 
mov esi,0x5580c0
 
mov edx,11
mov ecx,43
call draw_buttons
 
mov edx,41
mov ecx,43+8*8
call draw_buttons
 
mov edx,21
mov ecx,43+4*8
call draw_buttons
 
mov edx,31
mov ecx,43+2*8
call draw_buttons
 
mov edx,3
mov ecx,43+10*8
call draw_buttons
 
mov edx,51
mov ecx,43+12*8
call draw_buttons
 
mov edx,61
mov ecx,43+6*8
call draw_buttons
 
mov edx,91
mov ecx,43+18*8
call draw_buttons
 
mov edx,71
mov ecx,43+14*8
call draw_buttons
 
mov edx,81
mov ecx,43+16*8
call draw_buttons
 
mov edx,101
mov ecx,43+20*8
call draw_buttons
 
mov edx,111
mov ecx,43+22*8 ; 22
call draw_buttons
 
mov edx,121
mov ecx,43+24*8 ; 24
call draw_buttons
 
call draw_infotext
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
 
draw_infotext:
 
pusha
 
mov eax,[keyboard] ; KEYBOARD
test eax,eax
jnz noen
mov [text00+LLL*10+28],dword 'ENGL'
mov [text00+LLL*10+32],dword 'ISH '
noen:
cmp eax,1
jnz nofi
mov [text00+LLL*10+28],dword 'FINN'
mov [text00+LLL*10+32],dword 'ISH '
nofi:
cmp eax,2
jnz noge
mov [text00+LLL*10+28],dword 'GERM'
mov [text00+LLL*10+32],dword 'AN '
noge:
cmp eax,3
jnz nogr
mov [text00+LLL*10+28],dword 'RUSS'
mov [text00+LLL*10+32],dword 'IAN '
nogr:
cmp eax,4
jnz nofr
mov [text00+LLL*10+28],dword 'FREN'
mov [text00+LLL*10+32],dword 'CH '
nofr:
 
 
mov eax,[syslang] ; SYSTEM LANGUAGE
dec eax
test eax,eax
jnz noen5
mov [text00+LLL*8+28],dword 'ENGL'
mov [text00+LLL*8+32],dword 'ISH '
noen5:
cmp eax,1
jnz nofi5
mov [text00+LLL*8+28],dword 'FINN'
mov [text00+LLL*8+32],dword 'ISH '
nofi5:
cmp eax,2
jnz noge5
mov [text00+LLL*8+28],dword 'GERM'
mov [text00+LLL*8+32],dword 'AN '
noge5:
cmp eax,3
jnz nogr5
mov [text00+LLL*8+28],dword 'RUSS'
mov [text00+LLL*8+32],dword 'IAN '
nogr5:
cmp eax,4
jne nofr5
mov [text00+LLL*8+28],dword 'FREN'
mov [text00+LLL*8+32],dword 'CH '
nofr5:
 
 
mov eax,[midibase]
mov esi,text00+LLL*0+32
call hexconvert ; MIDI BASE
 
 
mov eax,[sb16] ; SB16 BASE
mov esi,text00+LLL*2+32
call hexconvert
 
 
mov eax,[wss] ; WSS BASE
cmp eax,1
jnz nowss1
mov [wssp],dword 0x530
nowss1:
cmp eax,2
jnz nowss2
mov [wssp],dword 0x608
nowss2:
cmp eax,3
jnz nowss3
mov [wssp],dword 0xe80
nowss3:
cmp eax,4
jnz nowss4
mov [wssp],dword 0xf40
nowss4:
 
mov eax,[wssp]
mov esi,text00+LLL*12+32
call hexconvert
 
mov eax,[cdbase] ; CD BASE
cmp eax,1
jnz noe1
mov [text00+LLL*4+28],dword 'PRI.'
mov [text00+LLL*4+32],dword 'MAST'
mov [text00+LLL*4+36],dword 'ER '
noe1:
cmp eax,2
jnz nof1
mov [text00+LLL*4+28],dword 'PRI.'
mov [text00+LLL*4+32],dword 'SLAV'
mov [text00+LLL*4+36],dword 'E '
nof1:
cmp eax,3
jnz nog1
mov [text00+LLL*4+28],dword 'SEC.'
mov [text00+LLL*4+32],dword 'MAST'
mov [text00+LLL*4+36],dword 'ER '
nog1:
cmp eax,4
jnz nog2
mov [text00+LLL*4+28],dword 'SEC.'
mov [text00+LLL*4+32],dword 'SLAV'
mov [text00+LLL*4+36],dword 'E '
nog2:
 
 
mov eax,[hdbase] ; HD BASE
cmp eax,1
jnz hnoe1
mov [text00+LLL*6+28],dword 'PRI.'
mov [text00+LLL*6+32],dword 'MAST'
mov [text00+LLL*6+36],dword 'ER '
hnoe1:
cmp eax,2
jnz hnof1
mov [text00+LLL*6+28],dword 'PRI.'
mov [text00+LLL*6+32],dword 'SLAV'
mov [text00+LLL*6+36],dword 'E '
hnof1:
cmp eax,3
jnz hnog1
mov [text00+LLL*6+28],dword 'SEC.'
mov [text00+LLL*6+32],dword 'MAST'
mov [text00+LLL*6+36],dword 'ER '
hnog1:
cmp eax,4
jnz hnog2
mov [text00+LLL*6+28],dword 'SEC.'
mov [text00+LLL*6+32],dword 'SLAV'
mov [text00+LLL*6+36],dword 'E '
hnog2:
 
 
mov eax,[f32p] ; FAT32 PARTITION
add al,48
mov [text00+LLL*14+28],al
 
mov eax,[sound_dma] ; SOUND DMA
add eax,48
mov [text00+LLL*16+28],al
 
mov eax,[lba_read]
call onoff ; LBA READ
mov [text00+LLL*18+28],ebx
 
mov eax,[pci_acc]
call onoff ; PCI ACCESS
mov [text00+LLL*20+28],ebx
 
mov eax,13
mov ebx,175*65536+85
mov ecx,40*65536+205
mov edx,0x80111199-19
int 0x40
 
mov edx,text00
mov ebx,10*65536+45
mov eax,4
mov ecx,0xffffff
mov esi,LLL
newline:
int 0x40
add ebx,8
add edx,LLL
cmp [edx],byte 'x'
jnz newline
 
popa
ret
 
drawtime:
mov ax,[time] ;hours 22
mov cl,1
call unpacktime
mov [text00+LLL*22+28],word bx
mov al,ah ;minutes
inc cl
call unpacktime
mov [text00+LLL*22+31],word bx
mov eax,[date]
mov ch,3
call unpackdate
mov [text00+LLL*24+34],word bx ;year 24
mov al,ah
mov ch,1
call unpackdate
mov [text00+LLL*24+28],word bx ;month
bswap eax
mov al,ah
inc ch
call unpackdate
mov [text00+LLL*24+31],word bx ;day
 
mov eax,13
mov ebx,175*65536+85
mov ecx,40*65536+205
mov edx,0x80111199-19
int 0x40
 
mov edx,text00
mov ebx,10*65536+45
mov eax,4
mov ecx,0xffffff
mov esi,LLL
newline1:
int 0x40
add ebx,8
add edx,LLL
cmp [edx],byte 'x'
jnz newline1
ret
 
unpacktime:
cmp byte [blinkpar],cl ;translate packed number to ascii
jne unpack1
chkblink:
bt dword [blinkpar],16
jnc unpack1
xor bx,bx
ret
unpackdate:
cmp byte [blinkpar+1],ch
je chkblink
unpack1:
xor bx,bx
mov bh,al
mov bl,al
and bh,0x0f
shr bl,4
add bx,0x3030
ret
 
hexconvert: ;converting dec to hex in ascii
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
mov [esi],cl
shr eax,4
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
dec esi
mov [esi],cl
shr eax,4
xor ebx,ebx
mov bl,al
and bl,15
add ebx,hex
mov cl,[ebx]
dec esi
mov [esi],cl
ret
 
onoff:
cmp [syslang],4
jne norus1
mov ebx,'„€ '
cmp eax,1
je exitsub
mov ebx,'…’ '
ret
norus1:
mov ebx,'ON '
cmp eax,1
je exitsub
mov ebx,'OFF '
exitsub:
ret
 
_midibase:
mov eax,21
mov ebx,1
mov ecx,[midibase]
int 0x40
ret
 
_cdbase:
mov eax,21
mov ebx,3
mov ecx,[cdbase]
int 0x40
ret
 
_hdbase:
mov eax,21
mov ebx,7
mov ecx,[hdbase]
int 0x40
ret
 
_sound_dma:
mov eax,21
mov ebx,10
mov ecx,[sound_dma]
int 0x40
ret
 
_lba_read:
mov eax,21
mov ebx,11
mov ecx,[lba_read]
int 0x40
ret
 
_pci_acc:
mov eax,21
mov ebx,12
mov ecx,[pci_acc]
int 0x40
ret
 
_f32p:
mov eax,21
mov ebx,8
mov ecx,[f32p]
int 0x40
ret
 
_sb16:
mov eax,21
mov ebx,4
mov ecx,[sb16]
int 0x40
ret
 
_wssp:
mov eax,21
mov ebx,6
mov ecx,[wssp]
int 0x40
ret
 
_syslang:
mov eax,21
mov ebx,5
mov ecx,[syslang]
int 0x40
ret
 
loadtxt:
cld
mov edi,text00
mov ecx,428
cmp [syslang],4
jne norus
mov esi,textrus
jmp sload
norus:
mov esi,texteng
sload:
rep movsd
ret
 
cleantxt:
xor eax,eax
mov ecx,428
cld
mov edi,text00
rep stosd
mov [text00+1711],byte 'x'
ret
 
settime:
mov dx,0x70
call startstopclk
dec dx
mov al,2 ;set minutes
out dx,al
inc dx
mov al,byte [time+1]
out dx,al
dec dx
mov al,4 ;set hours
out dx,al
inc dx
mov al,byte [time]
out dx,al
dec dx
mov al,7 ;set day
out dx,al
inc dx
mov al,byte [date+2]
out dx,al
dec dx
mov al,8 ;set month
out dx,al
inc dx
mov al,byte [date+1]
out dx,al
dec dx
mov al,9 ;set year
out dx,al
inc dx
mov al,byte [date]
out dx,al
dec dx
call startstopclk
ret
 
startstopclk:
mov al,0x0b
out dx,al
inc dx
in al,dx
btc ax,7
out dx,al
ret
 
; DATA AREA
count: db 0x0
blinkpar: dd 0x0
time: dw 0x0
date: dd 0x0
 
filename: db 'SETUP DAT',0
 
textrus:
 
db ' §  MIDI ROLAND MPU-401 : 0x320 - + à¨¬¥­¨âì'
db ' '
db ' §  SoundBlaster 16 : 0x240 - + à¨¬¥­¨âì'
db ' '
db ' §  CD-ROM  : PRI.SLAVE - + à¨¬¥­¨âì'
db ' '
db ' §  †„-1 : PRI.MASTER - + à¨¬¥­¨âì'
db ' '
db 'Ÿ§ëª á¨á⥬ë : ENGLISH - + à¨¬¥­¨âì'
db ' '
db ' áª« ¤ª  ª« ¢¨ âãàë : ENGLISH - + à¨¬¥­¨âì'
db ' '
db ' §  WSS : 0x200 - + à¨¬¥­¨âì'
db ' '
db ' §¤¥« FAT32 ­  †„-1 : 1 - + à¨¬¥­¨âì'
db ' '
db '‡¢ãª®¢®© ª ­ « DMA : 1 - + à¨¬¥­¨âì'
db ' '
db '‚ª«îç¨âì LBA : OFF - + à¨¬¥­¨âì'
db ' '
db '„®áâ㯠ª 設¥ PCI : OFF - + à¨¬¥­¨âì'
db ' '
db '‘¨á⥬­®¥ ¢à¥¬ï : 0:00 - + ‚ë¡®à '
db ' '
db '‘¨á⥬­ ï ¤ â  (¬,¤,£) : 00/00/00 - + ‚ë¡®à '
db ' '
db '‚ˆŒ€ˆ…: à¨¬¥­¨âì ¢á¥ '
db 'ˆ‘Ž‹œ‡“‰’… „Ž‘’“ Š FAT-32 Ž‘’ŽŽ†Ž! '
db '… ‡€“„œ’… ‘Ž•€ˆ’œ €‘’Ž‰Šˆ ‘®åà ­¨âì ¢á¥ '
db 'x'
 
texteng:
 
db 'MIDI: ROLAND MPU-401 BASE : 0x320 - + APPLY '
db ' '
db 'SOUND: SB16 BASE : 0x240 - + APPLY '
db ' '
db 'CD-ROM BASE : PRI.SLAVE - + APPLY '
db ' '
db 'HARDDISK-1 BASE : PRI.MASTER - + APPLY '
db ' '
db 'SYSTEM LANGUAGE : ENGLISH - + APPLY '
db ' '
db 'KEYBOARD LAYOUT : ENGLISH - + APPLY '
db ' '
db 'WINDOWS SOUND SYSTEM BASE : 0x200 - + APPLY '
db ' '
db 'FAT32-1 PARTITION IN HD-1 : 1 - + APPLY '
db ' '
db 'SOUND DMA CHANNEL : 1 - + APPLY '
db ' '
db 'LBA READ ENABLED : OFF - + APPLY '
db ' '
db 'PCI ACCESS FOR APPL. : OFF - + APPLY '
db ' '
db 'SYSTEM TIME : 0:00 - + SELECT '
db ' '
db 'SYSTEM DATE (M,D,Y) : 00/00/00 - + SELECT '
db ' '
db 'NOTE: APPLY ALL '
db 'TEST FAT32 FUNCTIONS WITH EXTREME CARE '
db 'SAVE YOUR SETTINGS BEFORE QUIT MENUET SAVE ALL '
db 'x'
 
labelt:
db '€‘’Ž‰Š€ “‘’Ž‰‘’‚ MENUET DEVICE SETUP '
 
hex db '0123456789ABCDEF'
 
alt_general:
 
; db ' ',27
; db ' @ $ {[]}\ ',8,9
; db ' ',13
; db ' ',0,' ',0,'4',0,' '
; db ' ',180,178,184,'6',176,'7'
; db 179,'8',181,177,183,185,182
; db 'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
; db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
en_keymap:
 
db '6',27
db '1234567890-=',8,9
db 'qwertyuiop[]',13
db '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
en_keymap_shift:
 
db '6',27
db '!@#$%^&*()_+',8,9
db 'QWERTYUIOP{}',13
db '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fr_keymap:
 
db '6',27
db '&Ž"',39,'(-_“)=',8,9
db 'azertyuiop^$',13
db '~qsdfghjklm’',0,0,'*wxcvbn,;:!',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
fr_keymap_shift:
 
 
db '6',27
db '1234567890+',8,9
db 'AZERTYUIOP•”',13
db '~QSDFGHJKLM%',0,'–WXCVBN?./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fr_keymap_alt_gr:
 
 
db '6',27
db 28,'~#{[|˜\^@]}',8,9
db 'azertyuiop^$',13
db '~qsdfghjklm’',0,0,'*wxcvbn,;:!',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
 
fi_keymap:
 
db '6',27
db '1234567890+[',8,9
db 'qwertyuiop',192,'~',13
db '~asdfghjkl',194,193,'1',0,39,'zxcvbnm,.-',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
fi_keymap_shift:
 
db '6',27
db '!"#%&/()=?]',8,9
db 'QWERTYUIOP',200,'~',13
db '~ASDFGHJKL',202,201,'1',0,'*ZXCVBNM;:_',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
ge_keymap:
 
db '6',27
db '1234567890?[',8,9
db 'qwertzuiop',203,'~',13
db '~asdfghjkl',194,193,'1',0,39,'yxcvbnm,.-',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
ge_keymap_shift:
 
db '6',27
db '!"#$%&/()=',197,']',8,9
db 'QWERTZUIOP',195,'~',13
db '~ASDFGHJKL',202,201,'1',0,'*YXCVBNM;:_',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
ru_keymap:
 
db '6',27
db '1234567890-=',8,9
db '©æ㪥­£èé§åê',13
db 0,"ä뢠¯à®«¤¦í"
db 0xf1, '-/'
db "ïçᬨâì¡î",'.-','45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
 
ru_keymap_shift:
 
db '6',27
db '!"N;%:?*()_+',8,0
db "‰–“Š…ƒ˜™‡•š",13
db 0,"”›‚€Ž‹„†"
db 0xf0, '-\'
db "Ÿ—‘Œˆ’œž",',-','45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
I_PARAM dd 0
 
keyboard dd 0x0
midibase dd 0x320
cdbase dd 0x2
sb16 dd 0x220
syslang dd 0x1
wss dd 0x1
wssp dd 0x0
hdbase dd 0x1
f32p dd 0x1
sound_dma dd 0x1
lba_read dd 0x1
pci_acc dd 0x1
 
text00:
 
I_END:
table_area:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/smtps/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm smtps.asm smtps
@pause
/programs/smtps/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm smtps.asm smtps
@pause
/programs/smtps/trunk/smtps.asm
0,0 → 1,849
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SMTP server for MenuetOS ;;
;; ;;
;; License: GPL / See file COPYING for details ;;
;; Copyright 2002 (c) Ville Turjanmaa ;;
;; ;;
;; Compile with FASM for Menuet ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include 'lang.inc'
version equ '0.1'
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x200000 ; required amount of memory
dd 0xffff0
dd 0,0
 
save_file:
 
pusha
 
cmp [file_start],0x100000+10
jbe nosub
sub [file_start],8
nosub:
 
mov edi,[file_start]
 
mov eax,[file_start]
sub eax,0x100000
mov [files+8],eax
 
mov eax,58
mov ebx,files
int 0x40
 
popa
 
ret
 
 
START: ; start of execution
 
mov [file_start],0x100000
 
mov eax,58
mov ebx,filel
int 0x40
 
cmp eax,0
jne notfound
add [file_start],ebx
notfound:
 
 
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
 
cmp eax,1 ; redraw
je redraw
cmp eax,2 ; key
je 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:
 
cmp [server_active],0
je noread
cmp [status],4
jne noread
call read_incoming_data
inc [close_connection]
cmp [close_connection],15*100
jbe noread
 
call yq
 
noread:
 
call print_status
 
cmp [status],4
je check_header
 
jmp still
 
 
check_header:
 
cmp [header_sent],1
je still
 
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,6
mov esi,r220
int 0x40
mov [header_sent],1
 
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
 
 
old_status dd 0x0
 
print_status:
 
pusha
 
mov eax,53
mov ebx,6
mov ecx,[socket]
int 0x40
 
mov [status],eax
 
cmp eax,[old_status]
je no_print
 
mov [old_status],eax
 
push eax
 
mov eax,13
mov ebx,360*65536+30
mov ecx,151*65536+10
mov edx,0xffffff
int 0x40
 
pop ecx
mov eax,47
mov ebx,3*65536
mov edx,360*65536+151
mov esi,0x000000
 
cmp [server_active],0
je no_print
 
int 0x40
 
no_print:
 
popa
 
ret
 
 
socket_commands:
 
cmp ah,22 ; open socket
jnz tst3
mov eax,3
int 0x40
 
mov [server_active],1
 
mov eax,53
mov ebx,5
mov ecx,25 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
 
ret
tst3:
 
 
cmp ah,24 ; close socket
jnz no_24
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
mov [header_sent],0
mov [mail_rp],0
mov [server_active],0
 
ret
no_24:
 
 
ret
 
 
 
key:
 
mov eax,2
int 0x40
 
jmp still
 
 
 
read_incoming_data:
 
pusha
 
read_new_byte:
 
call read_incoming_byte
cmp ecx,-1
je no_data_in_buffer
 
mov eax,[file_start]
mov [eax],bl
inc [file_start]
 
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,250
jge still
 
mov [eax+command-2],bl
inc [cmd]
 
jmp read_new_byte
 
no_data_in_buffer:
 
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
 
cmp [cmd],2
jbe nott
mov ecx,[cmd]
sub ecx,2
mov esi,command+0
newcmdc:
mov bl,[esi]
call print_character
inc esi
loop newcmdc
 
nott:
 
mov edx,I_END
call draw_channel_text
 
cmd_len_ok:
 
cmp [command],dword 'data'
je datacom
cmp [command],dword 'DATA'
je datacom
cmp [command],dword 'Data'
je datacom
jmp nodatacom
datacom:
inc [mail_rp]
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,6
mov esi,r354
int 0x40
mov [cmd],0
popa
ret
 
nodatacom:
 
cmp [mail_rp],0
jne nomrp0
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,6
mov esi,r250
int 0x40
mov [cmd],0
popa
ret
nomrp0:
 
 
 
cmp [command],dword 'QUIT'
je yesquit
cmp [command],dword 'Quit'
je yesquit
cmp [command],dword 'quit'
je yesquit
jmp noquit
yq:
pusha
 
yesquit:
 
mov [close_connection],0
 
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,6
mov esi,r221
int 0x40
mov [cmd],0
 
mov eax,5
mov ebx,5
int 0x40
 
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
 
mov eax,5
mov ebx,5
int 0x40
 
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
 
mov [header_sent],0
mov [mail_rp],0
 
call save_file
 
mov eax,5
mov ebx,20
int 0x40
 
mov eax,53
mov ebx,5
mov ecx,25 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
int 0x40
mov [socket], eax
 
popa
ret
noquit:
 
 
 
cmp [command],byte '.'
jne nodot
mov eax,53
mov ebx,7
mov ecx,[socket]
mov edx,6
mov esi,r250
int 0x40
mov [cmd],0
popa
ret
nodot:
 
popa
ret
 
 
r250 db '250 ',13,10
r221 db '221 ',13,10
r220 db '220 ',13,10
r354 db '354 ',13,10
 
 
 
draw_data:
 
pusha
 
add eax,[text_start]
mov [eax],bl
 
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
 
 
 
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+400
mov ecx,5*65536+200
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,23*65536+22
mov ecx,169*65536+10
mov edx,22
mov esi,0x55aa55
int 0x40
 
mov eax,8 ; button: close socket
mov ebx,265*65536+22
mov ecx,169*65536+10
mov edx,24
mov esi,0xaa5555
int 0x40
 
mov eax,38 ; line
mov ebx,5*65536+395
mov ecx,108*65536+108
mov edx,0x000000
int 0x40
 
mov ebx,5*65536+123 ; 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
 
 
 
 
 
draw_channel_text:
 
pusha
 
mov eax,4
mov ebx,10*65536+26
mov ecx,[scroll+4]
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,0xff0000
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,0x00ff00
no_blue:
int 0x40
add edx,[rxs]
add ebx,10
pop ecx
loop dct
 
popa
ret
 
 
 
text:
 
db ' Incoming mails are written to /rd/1/smtps.txt '
db ' The file can be fetched with TinyServer and a Html-browser. '
db ' Timeout is set to 15 seconds. '
db ' '
db ' Open SMTP server port 25 Close SMTP '
 
db 'x <- END MARKER, DONT DELETE '
 
 
irc_server_ip db 192,168,1,1
 
file_start dd 0x100000
 
files:
dd 1,0,0,0x100000,0xd0000
db '/rd/1/smtps.txt',0
filel:
dd 0,0,10000/512,0x100000,0xd0000
db '/rd/1/smtps.txt',0
 
 
server_active dd 0
 
status dd 0x0
header_sent db 0
 
channel_temp: times 100 db 0
channel_temp_length dd 0x0
 
close_connection dd 0x0
 
mail_rp dd 0
 
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
 
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
 
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 56
 
res: db 0,0
command: times 256 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: times 100 db 0x0
 
xpos dd 0
attribute dd 0
scroll dd 1
dd 8
 
numtext db ' '
 
wcolor dd 0x000000
 
labelt db 'Tiny SMTP email server v ',version
labellen:
 
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/spanel/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm spanel.asm spanel
@pause
/programs/spanel/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm spanel.asm spanel
@pause
/programs/spanel/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/spanel/trunk/spanel.asm
0,0 → 1,254
;
; PANEL SETUP
;
; 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 0x8000 ; memory for app
dd 0x8000 ; 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 ; just read it and ignore
int 0x40
 
shr eax,8
cmp eax,'0'
jb still
cmp eax,'9'
jg still
 
mov edi,[ent]
add edi,text
mov esi,edi
inc esi
mov ecx,3
cld
rep movsb
 
mov [edi],al
 
call draw_window
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,10
jne no_apply
 
mov esi,text+17
mov edi,I_END+10
mov ecx,12
newfe:
mov ebx,[esi]
mov [edi],ebx
mov [edi+4],byte ';'
add edi,5
add esi,55
loop newfe
mov [edi],byte 'x'
 
mov eax,33
mov ebx,filename
mov ecx,I_END+10
mov edx,5*12+1
mov esi,0
int 0x40
 
 
mov esi,1
newread:
inc esi
mov eax,9
mov ebx,I_END
mov ecx,esi
int 0x40
cmp esi,eax
jg all_terminated
 
cmp [I_END+10],dword 'PANE'
jne newread
cmp [I_END+14],dword 'L '
jne newread
 
mov eax,18
mov ebx,2
mov ecx,esi
int 0x40
 
mov eax,5
mov ebx,5
int 0x40
 
mov esi,1
 
jmp newread
 
all_terminated:
 
mov eax,5
mov ebx,25
int 0x40
 
mov eax,19
mov ebx,panel
mov ecx,0
int 0x40
 
 
no_apply:
 
cmp ah,11
jb no_entry
shr eax,8
sub eax,11
imul eax,55
add eax,17
mov [ent],eax
mov [text+eax],dword '0000'
call draw_window
jmp still
no_entry:
 
 
jmp still
 
 
ent dd 17
filename db 'PANEL DAT'
panel db 'PANEL '
 
; *********************************************
; ******* 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+385 ; [x start] *65536 + [x size]
mov ecx,100*65536+190 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; 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
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,25*65536+335 ;160
mov ecx,162*65536+12
mov edx,10
mov esi,0x80a0c0 ;0x6677cc
int 0x40
 
mov eax,8
mov ebx,340*65536+20
mov ecx,34*65536+10
mov edx,11
newb:
int 0x40
add ecx,10*65536
inc edx
cmp edx,23
jb newb
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0x224466
mov edx,text
mov esi,55
newline:
mov eax,4
int 0x40
add ebx,10
add edx,55
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 'width 0000 : 0 for full screen width <'
db 'buttons 0001 : 0 no frames , 1 frames <'
db 'soften_up 0001 : 0 no , 1 yes <'
db 'soften_down 0001 : 0 no , 1 yes <'
db 'minimize_left 0001 : 0 no , 1 yes <'
db 'minimize_right 0001 : 0 no , 1 yes <'
db 'icons_position 0130 : position in pixels <'
db 'menu_enable 0001 : 0 no , 1 yes <'
db 'setup_enable 0001 : 0 no , 1 yes <'
db 'graph_text 0000 : 0 graphics , 1 text <'
db 'soften_middle 0000 : 0 no , 1 yes <'
db 'icons 0000 : 0 start , 1 activate <'
db ' '
db ' APPLY '
db 'x'
 
 
labelt:
db 'PANEL SETUP'
labellen:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ss/trunk/@SS.ASM
0,0 → 1,553
; SCREENSAVER APPLICATION by lisovin@26.ru
;
; 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 0x40000 ; memory for app (256 Kb)
dd 0x40000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
include 'macros.inc'
 
;include 'debug.inc'
 
START:
mov eax,14
int 0x40
and eax,0xFFFF0000
mov [top_right_corner],eax
 
mov eax,40 ; ãáâ ­®¢¨âì ¬ áªã ᮡë⨩
mov ebx,110010b ; ॠ£¨à㥬 ­  ª« ¢¨ âãàã, ¬ëèì, ®âà¨á®¢ªã ä®­ 
int 0x40
 
mov eax,14 ; ¯®«ã稬 à §¬¥àë íªà ­ 
int 0x40
mov [y_max],ax
shr eax,16
mov [x_max],ax
 
event: ; ®¡à ¡®â稪 ᮡë⨩ (¢á¥å)
mov eax,26
mov ebx,9
int 0x40 ; ¯®«ãç¨âì ¢à¥¬ï á¨á⥬ë
; mov eax,3
; int 0x40
mov [evtime],eax ; § ¯®¬­¨âì ¥£®
mov eax,37
mov ebx,2
int 0x40
cmp eax,3 ; ¯à®¤®«¦¨¬, ¥á«¨ ­ ¦ â  á।­ïï ª­®¯ª  ¬ëè¨
jne still
mov eax,37 ; ¯à®¢¥à¨¬ ª®®à¤¨­ âë
mov ebx,0
int 0x40
cmp [top_right_corner],eax
je create_setup ; ᮧ¤ ñ¬ ®ª­® ­ áâனª¨, ¥á«¨ ¬ëèì ¢ ¢¥àå­¥¬ ¯à ¢®¬
; 㣫ã íªà ­ 
 
 
 
still: ; ®á­®¢­®© 横« ¯à®£à ¬¬ë
 
mov eax,23 ; ¦¤ñ¬ ᮡëâ¨ï ¢ â¥ç¥­¨¥ 1 ᥪ㭤ë
mov ebx,100
int 0x40
 
bt dword [params],0 ; ssaver works?
jc event
bt dword [params],1 ; setup works?
jc event
 
cmp eax,2 ; key in buffer ?
je event
cmp eax,5
je event
cmp eax,6
je event
 
mov eax,26
mov ebx,9
int 0x40
sub eax,[evtime]
xor edx,edx
mov ebx,60*100 ; ¯®¤¥«¨¬ ­  60*100, ¯®«ã稬 ¢à¥¬ï ¢ ¬¨­ãâ å
div ebx
cmp al,[time]
jb still
 
; current_time-evtime/100/60 = ¢à¥¬ï ¢ ¬¨­ãâ å á ¯à®è«®£® ᮡëâ¨ï
 
call create_ss
jmp still
 
 
 
create_setup:
bt dword [params],1
jc still
mov eax,51
mov ebx,1
mov ecx,sthread
mov edx,0x3F000
int 0x40
bts dword [params],1
jmp still
 
create_ss:
mov eax,51
mov ebx,1
mov ecx,thread
mov edx,0x3E000
int 0x40
bts dword [params],0
ret
 
thread:
mov eax,5
mov ebx,eax
int 0x40
mov eax,40
mov ebx,100010b
int 0x40
cmp dword [type],0
je drawsswin
cmp dword [type],24
je asminit
mov dword [delay],1
mov [lx1],10 ; for "draw line"
mov [lx2],40
mov [ly1],50
mov [ly2],100
mov [addx1],1
mov [addx2],1
mov [addy1],1
mov [addy2],1
jmp drawsswin
asminit: ; for "assembler"
mov dword [delay],25
mov eax,58
mov ebx,fileinfo
int 0x40
asminit1:
mov eax,data_from_file
mov [stringstart],eax
mov dword [stringlen],1
newpage:
mov word [stringpos],10
 
drawsswin:
xor eax,eax
mov ebx,eax
mov ecx,eax
mov bx,[x_max]
mov cx,[y_max]
inc ebx
inc ecx
mov edx,0x01000000
int 0x40
mov eax,13
xor edx,edx
int 0x40
tstill:
mov eax,23
mov ebx,[delay]
int 0x40
cmp eax,2
je thr_end
cmp eax,6
je thr_end
cmp dword [type],0
je tstill
cmp dword [type],24
je drawssasm
call draw_line
jmp tstill
thr_end:
btr dword [params],0
mov eax,26
mov ebx,9
int 0x40
mov [evtime],eax
or eax,-1
int 0x40
 
drawssasm:
mov edi,[stringstart]
add edi,[stringlen]
dec edi
mov eax,edi
sub eax,data_from_file
cmp eax,10450
ja asminit1
cmp word [edi],0x0a0d
jne noaddstring
add word [stringpos],10
add edi,2
mov [stringstart],edi
mov dword [stringlen],1
mov ax,[stringpos]
cmp ax,[y_max]
jb tstill
jmp newpage
noaddstring:
mov eax,4
mov ebx,10*65536
mov bx,[stringpos]
mov ecx,0x104ba010
mov edx,[stringstart]
mov esi,[stringlen]
int 0x40
inc dword [stringlen]
cmp byte [edi],byte ' '
je drawssasm
jmp tstill
 
draw_line:
 
xor esi,esi
xor edi,edi
mov si,[x_max]
mov di,[y_max]
 
mov eax,[addx1]
add [lx1],eax
mov eax,[addy1]
add [ly1],eax
 
mov eax,[addx2]
add [lx2],eax
mov eax,[addy2]
add [ly2],eax
 
cmp [lx1],1
jge dl1
mov [addx1],1
dl1:
cmp [lx2],1
jge dl2
mov [addx2],1
dl2:
cmp [lx1],esi
jbe dl3
mov [addx1],0xffffffff
dl3:
cmp [lx2],esi
jbe dl4
mov [addx2],0xffffffff
dl4:
 
cmp [ly1],1
jge dl5
mov [addy1],1
dl5:
cmp [ly2],2
jge dl6
mov [addy2],1
dl6:
cmp [ly1],edi
jbe dl7
mov [addy1],-1
dl7:
cmp [ly2],edi
jbe dl8
mov [addy2],-1
dl8:
 
mov eax,[lx2]
cmp [lx1],eax
jz dnol
 
mov bx,word [lx1]
shl ebx,16
mov bx,word [lx2]
 
mov cx,word [ly1]
shl ecx,16
mov cx,word [ly2]
 
mov eax,38
mov edx,[lcolor]
and edx,0xffffff
int 0x40
 
dnol:
 
add [lcolor],0x010201
 
ret
 
 
sthread: ; start of execution
 
call sdraw_window
 
sstill:
 
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je sthread
cmp eax,2 ; key in buffer ?
je sstill
cmp eax,3 ; button in buffer ?
je sbutton
 
jmp sstill
 
sbutton: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jne snoclose
 
btr dword [params],1
mov eax,-1 ; close this program
int 0x40
snoclose:
cmp ah,7
jne nosetfl
btc dword [params],0
call drawflag
call drawtype
call drawtime
jmp sstill
nosetfl:
bt dword [params],0
jc sstill
cmp ah,2
jne notypedown
mov eax,[type]
test eax,eax
je sstill
sub eax,12
jmp typeupdn
notypedown:
cmp ah,3
jne notypeup
mov eax,[type]
cmp eax,24
jae sstill
add eax,12
jmp typeupdn
notypeup:
cmp ah,4
jne notimedown
mov al,[time]
cmp al,1
jbe sstill
dec al
; das
jmp timeupdn
notimedown:
cmp ah,5
jne notimeup
mov al,[time]
cmp al,59 ; 0x59
jae sstill
inc al
; daa
jmp timeupdn
notimeup:
cmp ah,6
jne noshow
mov eax,5
mov ebx,150
int 0x40
call create_ss
jmp sstill
noshow:
jmp sstill
 
timeupdn:
mov [time],al
call drawtime
jmp sstill
typeupdn:
mov [type],eax
call drawtype
jmp sstill
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
sdraw_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+215 ; [x start] *65536 + [x size]
mov ecx,100*65536+70 ; [y start] *65536 + [y size]
mov edx,0x03400088 ; color of work area RRGGBB,8->color gl
int 0x40
 
mov eax,8
mov ebx,47*65536+10
mov ecx,31*65536+10
mov edx,2
mov esi,0x702050
int 0x40
push ebx
add ebx,13*65536
mov edi,ebx
inc edx
int 0x40
pop ebx
add ecx,15*65536
inc edx
int 0x40
mov ebx,edi
inc edx
int 0x40
mov ebx,160*65536+40
mov ecx,28*65536+14
inc edx
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,17 ; text length
int 0x40
add ebx,7*65536+25
mov ecx,0xffffff
mov edx,setuptext
mov esi,9
int 0x40
add ebx,15
add edx,esi
mov esi,30
int 0x40
mov ebx,169*65536+32
mov edx,buttext
mov esi,4
int 0x40
 
call drawtype
call drawtime
call drawflag
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
drawtype:
mov eax,13
mov ebx,80*65536+75
mov ecx,30*65536+12
mov edx,0xffffff
bt dword [params],0
jnc noblue
mov edx,0x4e00e7
noblue:
int 0x40
mov eax,4
mov ebx,82*65536+32
xor ecx,ecx
mov edx,typetext
add edx,[type]
mov esi,12
int 0x40
ret
 
drawtime:
mov eax,13
mov ebx,80*65536+15
mov ecx,45*65536+12
mov edx,0xffffff
bt dword [params],0
jnc noblue1
mov edx,0x4e00e7
noblue1:
int 0x40
mov eax,47
mov edx,82*65536+47
xor esi,esi
movzx ecx,byte [time]
mov ebx,0x00020000
int 0x40
ret
 
drawflag:
mov eax,8
mov ebx,150*65536+10
mov ecx,45*65536+10
mov edx,7
mov esi,0xe0e0e0
int 0x40
mov eax,4
mov ebx,153*65536+47
xor ecx,ecx
mov esi,1
mov edx,flag
bt dword [params],0
jc setf
inc edx
setf:
int 0x40
ret
 
; DATA AREA
buttext db 'SHOW'
flag db 'V '
labelt db 'SCREENSAVER SETUP'
setuptext db 'TYPE: < >TIME: < > MINUTES NEVER'
typetext db 'BLACK SCREENCOLOR LINES ASSEMBLER '
type dd 12
time db 15 ; ¢à¥¬ï ¤® § ¯ã᪠ § áâ ¢ª¨ ¢ ¬¨­ãâ å
delay dd 100
 
lx1 dd 10
lx2 dd 40
 
ly1 dd 50
ly2 dd 100
 
addx1 dd 1
addx2 dd 1
 
addy1 dd 1
addy2 dd 1
 
stringlen dd 1
stringstart dd 0
stringpos dw 10
 
params dd 0 ;if bit 0 set-ssaver works if bit 1 set-setup works
 
fileinfo:
dd 0,0,21,data_from_file,work_area
db '/RD/1/SS.ASM',0
 
I_END:
 
 
; UNINITIALIZED DATA:
 
lcolor dd ?
evtime dd ? ; ¢à¥¬ï ¯à¥¤ë¤ã饣® ᮡëâ¨ï
x_max dw ? ; à §¬¥àë íªà ­ 
y_max dw ?
 
top_right_corner dd ?
work_area:
rb 0x10000
data_from_file:
/programs/ss/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm @ss.asm @ss
@pause
/programs/ss/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm @ss.asm @ss
@pause
/programs/ss/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/stackcfg/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm stackcfg.asm stackcfg
@pause
/programs/stackcfg/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm stackcfg.asm stackcfg
@pause
/programs/stackcfg/trunk/stackcfg.asm
0,0 → 1,704
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Stack Configuration Tool ;
; ;
; Compile with FASM for Menuet ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x100000 ; memory for app
dd 0x7fff0 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
START: ; start of execution
 
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
 
shr eax,8
 
cmp eax,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
 
cmp eax,2
je read_stack_setup
 
cmp eax,3
je apply_stack_setup
 
cmp eax,11
jb no_set_interface
cmp eax,14
jg no_set_interface
sub eax,11
mov [interface],eax
call draw_window
jmp still
no_set_interface:
 
cmp eax,21
jb no_ip_sf
cmp eax,22
jg no_ip_sf
sub eax,21
not eax
and eax,1
mov [assigned],eax
call draw_window
jmp still
no_ip_sf:
 
cmp eax,7 ; GET IP
jne no_read_ip
mov [string_x],205
mov [string_y],80
mov [string_length],15
call read_string
mov esi,string-1
mov edi,ip_address
xor eax,eax
ip1:
inc esi
cmp [esi],byte '0'
jb ip2
cmp [esi],byte '9'
jg ip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp ip1
ip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,ip_address+3
jbe ip1
call draw_window
jmp still
no_read_ip:
 
cmp eax,5 ; GET COM PORT
jne no_read_comport
mov [string_x],272
mov [string_y],40
mov [string_length],3
call read_string
movzx eax,byte [string]
cmp eax,'A'
jb gcp1
sub eax,'A'-'9'-1
gcp1:
sub eax,48
shl eax,8
mov ebx,eax
movzx eax,byte [string+1]
cmp eax,'A'
jb gcp2
sub eax,'A'-'9'-1
gcp2:
sub eax,48
shl eax,4
add ebx,eax
movzx eax,byte [string+2]
cmp eax,'A'
jb gcp3
sub eax,'A'-'9'-1
gcp3:
sub eax,48
add ebx,eax
mov [com_add],ebx
call draw_window
jmp still
no_read_comport:
 
cmp eax,6 ; GET COM IRQ
jne no_read_comirq
mov [string_x],284
mov [string_y],50
mov [string_length],1
call read_string
movzx eax,byte [string]
cmp eax,'A'
jb gci1
sub eax,'A'-'9'-1
gci1:
sub eax,48
mov [com_irq],eax
call draw_window
jmp still
no_read_comirq:
 
cmp eax, 8 ; set gateway ip
jne no_set_gateway
 
mov [string_x],205
mov [string_y],90
mov [string_length],15
call read_string
mov esi,string-1
mov edi,gateway_ip
xor eax,eax
gip1:
inc esi
cmp [esi],byte '0'
jb gip2
cmp [esi],byte '9'
jg gip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp gip1
gip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,gateway_ip+3
jbe gip1
call draw_window
 
jmp still
 
no_set_gateway:
cmp eax, 9
jne no_set_subnet
 
mov [string_x],205
mov [string_y],100
mov [string_length],15
call read_string
mov esi,string-1
mov edi,subnet_mask
xor eax,eax
sip1:
inc esi
cmp [esi],byte '0'
jb sip2
cmp [esi],byte '9'
jg sip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp sip1
sip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,subnet_mask+3
jbe sip1
call draw_window
 
jmp still
 
no_set_subnet:
cmp eax, 10
jne no_set_dns
 
mov [string_x],205
mov [string_y],110
mov [string_length],15
call read_string
mov esi,string-1
mov edi,dns_ip
xor eax,eax
dip1:
inc esi
cmp [esi],byte '0'
jb dip2
cmp [esi],byte '9'
jg dip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp dip1
dip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,dns_ip+3
jbe dip1
call draw_window
 
jmp still
 
no_set_dns:
jmp still
 
 
 
read_stack_setup:
 
mov eax,52
mov ebx,0
int 0x40
mov [config],eax
 
mov eax,52
mov ebx,1
int 0x40
mov dword [ip_address],eax
 
mov eax,52
mov ebx,9
int 0x40
mov dword [gateway_ip],eax
 
mov eax,52
mov ebx,10
int 0x40
mov dword [subnet_mask],eax
 
mov eax,52
mov ebx,13
int 0x40
mov dword [dns_ip],eax
 
mov eax,[config] ; unwrap com IRQ
shr eax,8
and eax,0xf
mov [com_irq],eax
 
mov eax,[config] ; unwrap com PORT
shr eax,16
and eax,0xfff
mov [com_add],eax
 
mov eax,[config] ; unwrap IRQ
and eax,0xf
mov [interface],eax
 
mov eax,[config] ; unwrap com PORT
shr eax,7
and eax,1
mov [assigned],eax
 
call draw_window
 
jmp still
 
 
apply_stack_setup:
 
mov eax,[com_irq]
shl eax,8
mov ebx,[com_add]
shl ebx,16
add eax,ebx
add eax,[interface]
mov ebx,[assigned]
shl ebx,7
add eax,ebx
mov [config],eax
 
mov eax,52
mov ebx,3
mov ecx,dword [ip_address]
int 0x40
 
mov eax,52
mov ebx,11
mov ecx,dword [gateway_ip]
int 0x40
 
mov eax,52
mov ebx,12
mov ecx,dword [subnet_mask]
int 0x40
 
mov eax,52
mov ebx,14
mov ecx,dword [dns_ip]
int 0x40
 
mov eax,52
mov ebx,2
mov ecx,[config]
int 0x40
 
jmp still
 
 
string_length dd 16
string_x dd 200
string_y dd 60
 
string db '________________'
 
 
read_string:
 
mov edi,string
mov eax,'_'
mov ecx,[string_length]
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,0xffffff
int 0x40
 
mov eax,4
mov ebx,[string_x]
shl ebx,16
add ebx,[string_y]
mov ecx,0x000000
mov edx,string
mov esi,[string_length]
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,100*65536+330 ; [x start] *65536 + [x size]
mov ecx,100*65536+157 ; [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
 
 
mov eax,8 ; BUTTON : CLOSE WINDOW
mov ebx,(330-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,[button_color]
; int 0x40
 
mov eax,8 ; BUTTON : READ SETUP
mov ebx,90*65536+65
mov ecx,127*65536+12
mov edx,2
int 0x40
 
mov eax,8 ; BUTTON : APPLY SETUP
mov ebx,163*65536+65
mov ecx,127*65536+12
mov edx,3
int 0x40
 
mov eax,8 ; BUTTONS 11-14 : SELECT INTERFACE
mov ebx,29*65536+8
mov ecx,39*65536+8
mov edx,11
interface_select:
int 0x40
add ecx,10*65536
inc edx
cmp edx,11+4
jb interface_select
 
mov ebx,[interface] ; PRINT SELECTED INTERFACE 'X'
imul ebx,10
add ebx,31*65536+39
mov eax,4
mov ecx,0xffffff
mov edx,xx
mov esi,1
int 0x40
 
mov eax,8 ; BUTTONS 21-22 : SERVER / MANUAL IP
mov ebx,143*65536+8
mov ecx,69*65536+8
mov edx,21
mov esi,[button_color]
int 0x40
mov eax,8
mov ebx,143*65536+8
mov ecx,79*65536+8
mov edx,22
int 0x40
mov ebx,[assigned] ; PRINT SELECTED SERVER/MANUAL 'X'
not ebx
and ebx,1
imul ebx,10
add ebx,145*65536+69
mov eax,4
mov ecx,0xffffff
mov edx,xx
mov esi,1
int 0x40
 
mov eax,47 ; COM ADDRESS
mov ebx,3*65536+1*256
mov ecx,[com_add]
mov edx,272*65536+40
mov esi,0x000000
int 0x40
 
mov eax,47 ; COM IRQ
mov ebx,1*65536+1*256
mov ecx,[com_irq]
mov edx,(266+3*6)*65536+50
mov esi,0x000000
int 0x40
 
mov edi,ip_address
mov edx,205*65536+80
mov esi,0x000000
mov ebx,3*65536
ipdisplay:
mov eax,47
movzx ecx,byte [edi]
int 0x40
add edx,6*4*65536
inc edi
cmp edi,ip_address+4
jb ipdisplay
 
mov edi,gateway_ip
mov edx,205*65536+90
mov esi,0x000000
mov ebx,3*65536
gipdisplay:
mov eax,47
movzx ecx,byte [edi]
int 0x40
add edx,6*4*65536
inc edi
cmp edi,gateway_ip+4
jb gipdisplay
 
mov edi,subnet_mask
mov edx,205*65536+100
mov esi,0x000000
mov ebx,3*65536
sipdisplay:
mov eax,47
movzx ecx,byte [edi]
int 0x40
add edx,6*4*65536
inc edi
cmp edi,subnet_mask+4
jb sipdisplay
 
mov edi,dns_ip
mov edx,205*65536+110
mov esi,0x000000
mov ebx,3*65536
dipdisplay:
mov eax,47
movzx ecx,byte [edi]
int 0x40
add edx,6*4*65536
inc edi
cmp edi,dns_ip+4
jb dipdisplay
 
 
mov eax,8 ; BUTTON 5 : SET PORT
mov ebx,299*65536+8
mov ecx,39*65536+8
mov edx,5
mov esi,[button_color]
int 0x40
mov eax,8 ; BUTTON 6 : SET IRQ
mov ebx,299*65536+8
mov ecx,49*65536+8
mov edx,6
int 0x40
mov eax,8 ; BUTTON 7 : SET IP
mov ebx,299*65536+8
mov ecx,79*65536+8
mov edx,7
int 0x40
 
mov eax,8 ; BUTTON 8 : SET gateway IP
mov ebx,299*65536+8
mov ecx,89*65536+8
mov edx,8
int 0x40
 
mov eax,8 ; BUTTON 9 : SET subnet
mov ebx,299*65536+8
mov ecx,99*65536+8
mov edx,9
int 0x40
 
mov eax,8 ; BUTTON 10 : SET dns ip
mov ebx,299*65536+8
mov ecx,109*65536+8
mov edx,10
int 0x40
 
mov ebx,31*65536+40 ; draw info text with function 4
mov edx,text
mov esi,49
newline:
mov ecx,0x224466
cmp [edx],byte 'w'
jne nowhite
mov ecx,0xeeeeee
nowhite:
inc edx
mov eax,4
int 0x40
add ebx,10
add edx,49
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 ' Not active Modem Com Port: 0x < '
db ' Slip Modem Com Irq: 0x < '
db ' PPP '
db ' Packet Driver IP server assigned '
db ' Fixed: . . . < '
db ' Gateway: . . . < '
db ' Subnet: . . . < '
db ' DNS IP: . . . < '
db ' '
db 'w READ APPLY '
 
xx: db 'x <- END MARKER, DONT DELETE '
 
button_color dd 0x2254b9
 
labelt: db 'STACK CONFIGURATION'
labellen:
 
ip_address db 000,000,000,000
gateway_ip db 000,000,000,000
subnet_mask db 000,000,000,000
dns_ip db 000,000,000,000
 
com_irq dd 0 ; irq for slip/ppp
com_add dd 0 ; com port address for slip/ppp
interface dd 0 ; not active,slip,ppp,packet driver
assigned dd 1 ; get ip from server
 
config dd 0
 
I_END:
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/stackinf/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm stackinf.asm stackinf
@pause
/programs/stackinf/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm stackinf.asm stackinf
@pause
/programs/stackinf/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/stackinf/trunk/stackinf.asm
0,0 → 1,158
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; ETHERNET SETUP
;;
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,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
int 0x40
cmp ah,1 ; button id=1 ?
jnz noclose
mov eax,-1 ; close this program
int 0x40
noclose:
cmp ah,2
jne no_details
mov eax,19
mov ebx,file1
mov ecx,file2
int 0x40
jmp still
no_details:
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, 50*65536+370 ; [x start] *65536 + [x size]
mov ecx,100*65536+230 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80557799 ; color of grab bar RRGGBB,8->color glide
mov edi,esi ; color of frames RRGGBB
and edi,0xffffff
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
; BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,202*65536+135 ; [x start] *65536 + [x size]
mov ecx,190*65536+16 ; [y start] *65536 + [y size]
mov edx,2 ; button id
mov esi,edi ; button color RRGGBB
int 0x40
mov ebx,6*65536+35 ; draw info text with function 4
mov ecx,0;xffffff
mov edx,text
mov esi,60
newline:
mov eax,4
int 0x40
add ebx,10
add edx,60
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 ' ETHERNET CONNECTION BETWEEN MENUET AND A TFTP SERVER '
db ' '
db ' 1) CURRENT ETHERNET CODE IS FOR RTL 8029 AND i8255x '
db ' BASED PCI CARDS '
db ' 2) START STACK CONFIG FROM NET MENU AND PRESS THE '
db ' READ BUTTON, ACTIVATE PACKET DRIVER, SET DESIRED '
db ' IP ADDRESS & APPLY '
db ' 3) SET THE SERVERS IP ADDRESS TO EG. 192.168.1.24 '
db ' '
db ' THE MENUET MACHINE SHOULD NOW BE ABLE TO RESPOND TO A '
db ' PING FROM THE SERVER, TRANSFER FILES USING TFTP AND USE '
db ' IRC CLIENT. SEE MENUET PAGES FOR MORE TCP/IP APPLICATIONS.'
db ' '
db ' MOST LINUX DISTRIBUTIONS HAVE A TFTP SERVER INCLUDED '
db ' FOR MS YOU CAN DOWNLOAD TFTPD FROM TFTPD32.JOUNIN.NET '
db ' '
db ' DETAILED DESCRIPTION '
db 'x'
file1: db 'TINYPAD '
file2: db 'STACK.TXT',0
labelt:
db 'NETWORK INFO'
labellen:
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sysmeter/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm sysmeter.asm sysmeter
@pause
/programs/sysmeter/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm sysmeter.asm sysmeter
@pause
/programs/sysmeter/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sysmeter/trunk/sysmeter.asm
0,0 → 1,197
;
; CPU USAGE for MenuetOS - Compile with FASM 1.30+
;
 
use32
 
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os version
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 set_variables
 
call draw_window
 
mov edi,0
 
still:
 
mov eax,23
mov ebx,10
int 0x40
 
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
 
inc edi
cmp edi,10
jb still
 
mov edi,0
call draw_usage
 
jmp still
 
red:
call draw_window
jmp still
 
key:
mov eax,2
int 0x40
jmp still
 
button:
mov eax,17
int 0x40
cmp al,byte 0
jnz still
mov eax,-1
int 0x40
 
 
set_variables:
 
pusha
 
mov ecx,190
mov edi,pros
mov eax,100
cld
rep stosb
 
popa
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,50*65536+207
mov ecx,50*65536+127
mov edx,0x03000000
mov esi,0x806688aa
 
mov edi,0x0088ccee
int 0x40
 
mov eax,4 ; 'CPU USAGE'
mov ebx,8*65536+8
mov ecx,dword 0x00ffffff
mov edx,text
mov esi,textlen-text
int 0x40
 
mov eax,12 ; tell os about redraw end
mov ebx,2
int 0x40
 
popa
ret
 
 
 
draw_usage:
 
pusha ; CPU usage
 
cld
mov eax,18 ; TSC / SEC
mov ebx,5
int 0x40
shr eax,20
push eax
 
mov eax,18 ; IDLE / SEC
mov ebx,4
int 0x40
shr eax,20
xor edx,edx
mov ebx,100
mul ebx
 
xor edx,edx
pop ebx
add ebx,1
div ebx
push eax
 
mov esi,pros+1
mov edi,pros
mov ecx,195
cld
rep movsb
 
pop eax
mov [pros+99],al
 
mov eax,13
mov ebx,5*65536+1
mov esi,pros
mov edi,pros+99
 
newpros:
 
add esi,1
 
xor eax,eax ; up
mov al,[esi]
add eax,1
mov ecx,22*65536
mov cx,ax
mov eax,13
mov edx,0x0
int 0x40
 
pusha ; down
xor eax,eax
mov al,[esi]
mov ecx,22
add ecx,eax
shl ecx,16
mov cx,101
sub cx,ax
mov eax,13
mov edx,0xdddddd
int 0x40
popa
 
add ebx,2*65536
 
cmp esi,edi
jb newpros
 
popa
ret
 
 
; DATA AREA
 
text: db 'CPU LOAD HISTORY '
textlen:
 
pros:
 
I_END:
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/systrace/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm systrace.asm systrace
@pause
/programs/systrace/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm systrace.asm systrace
@pause
/programs/systrace/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/systrace/trunk/systrace.asm
0,0 → 1,211
;
; SYSTEM CALL TRACE , V.Turjanmaa
;
; 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 ; at first, draw the window
 
still:
 
mov eax,23 ; wait here for event
mov ebx,50
int 0x40
 
call display_calls
 
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
 
 
; *********************************************
; ******* 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+465 ; [x start] *65536 + [x size]
mov ecx,50*65536+265 ; [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,0x00ddeeff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
mov eax,4
mov ebx,15*65536+55
mov ecx,0x0
mov edx,text
mov esi,70
int 0x40
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(465-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,0x6677cc ; button color RRGGBB
; int 0x40
 
call display_calls
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
 
 
display_calls:
 
 
pusha
 
mov eax,13
mov ebx,15*65536+70
mov ecx,35*65536+10
mov edx,0xffffff
int 0x40
 
mov eax,59
mov ebx,0
mov ecx,I_END
mov edx,64*16
int 0x40
 
mov ecx,eax
mov eax,47
mov ebx,10*65536
mov edx,15*65536+35
mov esi,0
int 0x40
 
 
mov ebx,75
mov edx,I_END
newline:
 
push ebx
push edx
 
mov edi,0
 
new_x:
 
mov eax,13
mov ebx,edi
shl ebx,6+16
add ebx,15*65536
mov bx,6*8
mov ecx,[esp+4]
shl ecx,16
mov cx,10
mov edx,0xffffff
int 0x40
 
mov eax,47
mov ebx,1+1*256+8*65536
 
mov ecx,[pos+edi*4]
shl ecx,2
add ecx,[esp+0]
 
mov edx,edi
shl edx,6+16
mov dx,[esp+4]
or edx,15*65536
mov esi,0x0
int 0x40
 
inc edi
 
cmp edi,7
jb new_x
 
pop edx
pop ebx
 
add ebx,10
add edx,64
 
cmp edx,I_END+16*64
jb newline
 
popa
ret
 
 
 
 
; DATA AREA
 
pos dd 0,15,12,14,13,9,8
 
text:
db ' PID EAX EBX ECX EDX ESI EDI '
 
 
labelt:
db 'SYSTEM CALL TRACE'
labellen:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sysxtree/trunk/SYSTR12.GIF
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/sysxtree/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 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 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:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sysxtree/trunk/ascl.inc
0,0 → 1,838
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 0 & loword eqtype [123]
mov reg,(hiword)*65536
add reg,loword
else if (hiword eq ) & (loword eq )
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
if ~(arg4 eq )
mov ecx,arg4 ;arg4 color
end if
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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sysxtree/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm sysxtree.asm sysxtree
@pause
/programs/sysxtree/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm sysxtree.asm sysxtree
@pause
/programs/sysxtree/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/sysxtree/trunk/sysxtree.asm
0,0 → 1,2758
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; SYSTEM X-TREE BROWSER ;
; ;
; Author: Pavlushin Evgeni waptap@mail.ru ;
; site: www.deck4.narod.ru ;
; ;
; Compile with FASM for MenuetOS ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;Bug report +bug deleted -bug not deleted
;show/fade del notwork+
;64Ver Run file from HD bug deleted.
;65Ver The bad scroll realization
;66Ver The good scroll realization, url line anti-flick
;67Ver Url line monolith procedure
;68Ver Mini icon on left of file name
;69Ver Getimg proc size minus 900 bytes
;70Ver Del data area ramsize minus 140000 bytes
;72Ver Quick sort, ramsize minus 200000 bytes
;73Ver Url flick and out bugs delete
;74Ver scroll bug deleted
;75Ver hd partition fast change button. Add bmp,txt,exec,asm and inc icons.
; sort type in headmenu bug del
;78Ver directory extension bug fix by Asko Vuori
;79Ver Asko Vuori volume label add and "put in command line" bug fix
;80Ver prompt edit fatal bug deleted, antiflick when move list up/down
;81Ver Save Dialog bug deleted
;600000 bytes memory!
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; program start
dd I_END ; program image size
dd RAM_END ; memory
dd RAM_END ; stack
dd param_area ,0x0 ; param,icon
; dd 0,0
 
;******************************************************************************
include 'lang.inc'
include 'macros.inc'
include 'ascl.inc'
include 'ascgl.inc'
gif_hash_offset = gif_hash
 
START: ; start of execution
; //// Willow
mov eax,58
mov ebx,MRUfile
int 0x40
; //// Willow
 
mov eax,40
mov ebx,0100111b
int 0x40
 
cmp byte [param_area],0 ;test parameters line
jne no_brow ;it's dialog
mov [browser],dword 1 ;it's browser
no_brow:
 
cmp [browser],dword 1
je no_dlg
 
mov al,byte [param_area+5]
mov [dlg_type],al
 
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
mov eax,dword [procinfo+30]
mov edi,MYPID+4-1
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
 
movzx eax,byte [param_area]
sub eax,48
imul eax,10
movzx ebx,byte [param_area+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [param_area+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [param_area+3]
add eax,ebx
sub eax,48
 
mov ecx,eax ;pid to ecx
mov eax,60
mov ebx,2
mov edx,MYPID
mov esi,4
int 0x40
no_dlg:
 
giftoimg but_file,tempimg
 
;************************
; Get images
;************************
 
mov eax,0 ;x
mov ebx,0 ;y
mov esi,286 ;xs
mov edi,16 ;ys
mov ecx,tempimg ;src
mov edx,butimg ;dest
call getimgproc
mov eax,288
mov esi,60
mov edx,logoimg ;dest
call getimgproc
mov eax,0 ;x
mov ebx,16 ;y
mov esi,51 ;xs
mov edi,esi ;ys
mov edx,logoinfimg ;dest
call getimgproc
mov eax,51 ;x
mov esi,8 ;xs
mov edi,9 ;ys
mov edx,upsb ;dest
call getimgproc
mov eax,51+8 ;x
mov edx,dnsb ;dest
call getimgproc
 
mov eax,51+16 ;x
mov ebx,16 ;y
mov esi,12 ;xs
mov edi,9 ;ys
 
mov ecx,tempimg ;src
mov edx,hdico ;dest
mov ebp,9
loogetimg:
call getimgproc
add edx,9*12*3+8
add eax,12
dec ebp
jnz loogetimg
jmp endgip
 
getimgproc:
pushad
mov dword [edx],esi ;xs
mov dword [edx+4],edi ;ys
 
mov ebp,eax
mov eax,dword [ecx] ;getx size
push edx
push ecx
lea ecx,[eax+2*eax]
 
mul ebx
add eax,ebp ;x
mov edx,ecx
lea eax,[eax+2*eax] ;eax=offset on imsrc
 
mov ecx,esi ;xs
mov ebx,edi ;ys
 
mov ebp,esi
 
pop edi
lea esi,[eax+8+edi]
 
pop edi
add edi,8
 
cld
cyc:
movsw
movsb
dec ecx
jne cyc
add esi,edx
mov ecx,ebp ;xs
sub esi,ecx
sub esi,ecx
sub esi,ecx
dec ebx
jne cyc
 
popad
ret
 
endgip:
 
call read_directory
; call convertation
red:
call draw_window ; at first, draw the window
 
still:
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
wtevent red,key,button
 
scrolltest:
mov eax,37
mov ebx,2
int 0x40
cmp eax,1
jne still
 
scrl:
mov eax,37
mov ebx,1
int 0x40
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov ebp,eax
sub ebp,[listx] ;[procinfo.x_size]
sub ebp,[listxsize]
add ebp,[scrollsize]
cmp ebp,dword [scrollsize] ;8
ja menu_test ; still
 
mov ebp,ebx
sub ebp,[listy] ;76 ;up scroll
sub ebp,[scrollbutsize]
cmp ebp,0
jl menu_test
mov [mousey],ebp
 
push eax ebx edx
mov edx,0
mov eax,[listysize]
sub eax,2
mov ebx,dword 10
div ebx
 
mov [filelistsize],eax
mov ebx,eax
cmp ebx,[listsize] ;filelistsize in ebx
ja notusescrl
 
mov edx,0
mov eax,[listysize]
sub eax,[scrollbutsize]
sub eax,[scrollbutsize]
 
shl eax,16+6
div dword [listsize]
mul ebx
shr eax,16+6
 
mov ebp,eax ; in ebp ysize of scroll
 
mov edx,0
mov eax,[listsize]
 
mov ebx,[listysize]
sub ebx,[scrollbutsize]
sub ebx,[scrollbutsize]
shl eax,16
div ebx ;dword [listsize]
mul [mousey]
shr eax,16
 
mov ebx,[listsize]
sub ebx,[filelistsize]
cmp eax,ebx
jnae no_cor
mov eax,[listsize] ;correction for full dirs (1000 files)
sub eax,[filelistsize]
no_cor:
mov [filecursor],eax
 
jmp usescrl
notusescrl:
mov [filecursor],0 ;ebp
usescrl:
 
pop edx ebx eax
 
mov esi,[listy];[procinfo.y_size]
add esi,[listysize]
sub esi,[scrollbutsize]
 
cmp ebx,esi
jna oks ;menu_test ;still
 
sub esi,ebp
inc esi ;correction
cmp ebx,esi
ja menu_test ;still
oks:
 
mov [flick],1
jmp anti_flick ;red
 
menu_test:
cmp [pmenu_draw],1 ;if menu is show, update all
jne still
mov [pmenu_draw],0
jmp red ;update all window
 
;this function not use in dialog when poup menu's is not used
;in dialog's
 
;===================
; Test keyboard
;===================
key: ; key
mov eax,2
int 0x40
cmp dword [focus],0
jne con_edit
cmp ah,key_Up
jne no_upk
mov ebx,1
jmp up
no_upk:
cmp ah,key_Down
jne no_downk
mov ebx,1
jmp down
no_downk:
cmp ah,key_PgUp
jne no_pgup
mov ebx,10
jmp up
no_pgup:
cmp ah,key_PgDown
jne no_pgdown
mov ebx,10
jmp down
no_pgdown:
cmp ah,key_Enter
jne no_k_ent
jmp kfad
no_k_ent:
cmp ah,key_Bspace
je back
cmp ah,key_F2
je viewset
cmp ah,key_F3
je textopen
cmp ah,key_F5
je copy_to_clip
cmp ah,key_F6
je paste_from_clip
cmp ah,key_F11
je edit_prompt
cmp ah,key_F12
je update
jmp still
 
; test input string
con_edit:
cmp ah,key_Enter
jne no_con_ent
not [focus]
jmp savetest
jmp update
no_con_ent:
cmp ah,key_Left
jne no_con_left
dec [cursor]
mov [flick],2
jmp anti_flick ;red
no_con_left:
cmp ah,key_Right
jne no_con_right
inc [cursor]
mov [flick],2
jmp anti_flick ;red
no_con_right:
cmp ah,key_Bspace
jne no_con_bspace
 
mov ecx,[cursor]
cmp ecx,0
je still
dec ecx
mov ebp,[cursor]
lobsp:
mov bl,byte [path+ebp]
mov byte [path+ebp-1],bl
inc ebp
cmp ebp,100
jne lobsp
dec [cursor]
mov [flick],2
jmp anti_flick ;red
no_con_bspace:
 
mov ecx,[cursor]
dec ecx
mov ebp,100 ;[cursor]
losx:
mov bl,byte [path+ebp]
mov byte [path+ebp+1],bl
dec ebp
cmp ebp,ecx ;100
jne losx
 
mov ebp, [cursor]
cmp ebp,100
ja still
 
mov byte [path+ebp],ah
inc dword [cursor]
 
mov [flick],2
jmp anti_flick
 
 
;----------------------------
;Test on mouse button
;-----------------------------
 
button: ; button
mov eax,17
int 0x40
 
cmp ah,2 ;Edit prompt line?
je edit_prompt
 
cmp ah,4
jne no_filelist
 
mousetest:
mov eax,37
mov ebx,1
int 0x40
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
sub ebx,[listy] ;80
mov [mousey],ebx
 
mov ecx,[listx]
cmp eax,ecx
jl still
add ecx,[listxsize]
cmp eax,ecx
jg still
 
filexadd:
 
; Enter in directory
file_add:
mov edx,0 ;for div correct work div
mov eax,dword [mousey]
mov ebx,10
div ebx
 
add eax,[filecursor]
jmp no_kfad
kfad:
mov eax,[filecursor]
no_kfad:
mov ebx,62
mul ebx
mov ebp,eax
 
mov edi,paramtest ;clear param string
mov ecx,256
mov al,0
rep stosb
 
 
mov esi,0
lll2:
mov al,byte [path+esi]
cmp al,byte 0 ;' '; '/'
je fis2
cmp al,byte ' '; '/'
je fis2
inc esi
cmp esi,100
jna lll2
jmp fis2
 
fis2:
mov edi,ebp
cmp [convinfo+edi+26],dword 'FOL '
jne openf
mov [path+esi],byte '/'
inc esi
mov ebp,8
 
los: ;directory extension bug fix
mov al,[convinfo+edi]
cmp al,' '
jz skip_name_space
mov [path+esi],al
inc esi
skip_name_space:
inc edi
dec ebp
jnz los
 
cmp byte [convinfo+edi],'.'
jnz dir_name_end
cmp byte [convinfo+edi+1],' '
jz dir_name_end
mov ebp,4
dir_ext_char:
mov al,[convinfo+edi]
cmp al,' '
jz dir_name_end
mov [path+esi],al
inc esi
inc edi
dec ebp
jnz dir_ext_char
dir_name_end:
mov [filecursor],0
 
;los:
; mov al,[convinfo+edi]
; mov [path+esi],al
; inc esi
; inc edi
; dec ebp
; jnz los
; mov [filecursor],0
; cmp byte [dlg_type],'S'
; je savetest
;no_save:
 
call read_directory
;; call convertation
call draw_window
; jmp still
 
;Savetest
savetest:
cmp byte [dlg_type],'S'
je savetest_yes
jmp still
savetest_yes:
mov ecx,100
savetestloop:
cmp [path+ecx],byte 0
je next_byte
cmp [path+ecx],byte 32
je next_byte
cmp [path+ecx],byte '.'
je openf ;it's file
; cmp [path+ecx],byte '/'
; je no_save ;it's dir
next_byte:
dec ecx
jnz savetestloop
jmp still
 
;Open/Run file
 
openf:
mov ecx,100
lopt:
mov al,[path+ecx]
mov [paramtest+ecx],al
dec ecx
jns lopt
 
; mov ebp,100
;loow:
; cmp [paramtest+ebp],byte '.'
; je file_set
; dec ebp
; jnz loow ;is file set not file add
 
cmp dword [focus],0 ;if prompt line with focus no add file name from frame
jne file_set
 
mov [paramtest+esi],byte '/'
inc esi
mov ebp,8+4
mov edx,edi
losf:
mov al,[convinfo+edi]
mov [paramtest+esi],al
inc esi
inc edi
dec ebp
jnz losf
file_set:
 
cmp [browser],0
jne is_brow
 
movzx eax,byte [param_area]
sub eax,48
imul eax,10
movzx ebx,byte [param_area+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [param_area+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [param_area+3]
add eax,ebx
sub eax,48
 
mov ecx,eax ;pid to ecx
mov eax,60
mov ebx,2
mov edx,paramtest
mov esi,100
int 0x40
 
jmp exit
 
is_brow:
 
; cmp [convinfo+edi+26],dword 'Fvol'
; je edit
 
mov eax,dword [convinfo+edx+8]
cmp eax,'. '
jne noexecute
mov ebx,0
jmp execute
noexecute:
 
cmp eax,'.JPG'
jne nojv
jpg_jpe:
mov ebx,jpgview
jmp run
nojv:
cmp eax,'.JPE'
je jpg_jpe
cmp eax,'.GIF'
jne nojv1
mov ebx,gifview
jmp run
nojv1:
cmp eax,'.WAV'
jne nojv12
mov ebx,ac97wav
jmp run
nojv12:
cmp eax,'.BMP'
jne nobv
mov ebx,bmpview
jmp run
nobv:
; //// Willow
cmp eax,'.PNG'
jne nopngv
mov ebx,pngview
jmp run
nopngv:
; //// Willow
cmp eax,'.ASM'
je edit
cmp eax,'.TXT'
je edit
cmp eax,'.INC'
je edit
cmp eax,'.DAT'
je edit
jmp still
edit:
mov ebx,editor
jmp run
 
execute:
mov ecx,0 ;200
loexe:
mov al,[paramtest+ecx]
; cmp al,0
; je setzr
; cmp al,' '
; je setzr
; je badl
cmp al,'.'
je setzr
; je badl
; jmp okl
;badl:
; mov al,0
okl:
mov [open_path+ecx],al
inc ecx
cmp ecx,200
jnae loexe
 
setzr:
; add ecx,3
; mov al,0
mov [open_path+ecx],byte 0 ;al
 
mov eax,58
mov ebx,fileinfo_start
int 0x40
 
jmp still
 
run:
mov ecx,paramtest
mov eax,19
int 0x40
jmp still
 
no_filelist:
 
cmp ah,5 ;OPEN/SAVE button
je kfad
 
cmp ah,6 ;Scroll up
jne no_scrlup
mov ebx,1
jmp up
no_scrlup:
 
cmp ah,7 ;Scroll down
jne no_scrldown
mov ebx,1
jmp down
no_scrldown:
 
cmp ah,8
jne no_update
update:
call read_directory
; call convertation
; mov [filecursor],0
call draw_window
no_update:
 
cmp ah,9
jne no_textopen
textopen:
mov esi,0
xlll2:
mov al,byte [path+esi]
cmp al,byte '/'
jne xfis2
inc esi
cmp esi,12*20
jnae xlll2
jmp still
xfis2:
mov al,byte [path+esi]
cmp al,byte ' '
je xaa2
inc esi
cmp esi,12*20
jnae xfis2
jmp still
xaa2:
mov eax,[filecursor]
mov ebx,62
mul ebx
mov edi,eax
cmp [convinfo+edi+26],dword 'FOL '
je still
mov ecx,12*20
xlopt:
mov al,[path+ecx]
mov [paramtest+ecx],al
dec ecx
jns xlopt
mov [paramtest+esi],byte '/'
inc esi
mov ebp,8+4
mov edx,edi
xlosf:
mov al,[convinfo+edi]
mov [paramtest+esi],al
inc esi
inc edi
dec ebp
jnz xlosf
mov [paramtest+esi],byte 0
mov ebx,editor
mov ecx,paramtest
mov eax,19
int 0x40
jmp red ;still
 
no_textopen:
 
cmp ah,11
jne no_view
viewset:
; not dword [delflag]
inc dword [viewmode]
cmp dword [viewmode],8
jnae not_cm
mov [viewmode],0
not_cm:
call read_directory
; call convertation
mov [filecursor],0
call draw_window
jmp still
no_view:
 
cmp ah,12 ;move back
jne no_back
back:
mov esi,12*20
lll:
mov al,byte [path+esi]
cmp al,byte ' '
jne findsl
dec esi
jnz lll
jmp still
findsl:
dec esi
fis:
mov al,byte [path+esi]
cmp al,byte '/'
je aa
mov [path+esi],byte 0 ;' '
dec esi
jnz fis
aa:
mov [path+esi],byte 0 ;' '
 
mov [filecursor],0
call read_directory
; call convertation
call draw_window
jmp still
 
no_back:
cmp ah,13 ;string up?
jne no_up
mov ebx,1 ;step
up:
mov [downstop],0
sub [filecursor],ebx
cmp [filecursor],0
jnl cr_ok
mov [filecursor],0
cr_ok:
jmp draw_wd
no_up:
cmp ah,14 ;string down?
jne no_dn
mov ebx,1 ;step
down:
cmp [downstop],1
je no_dn
add [filecursor],ebx
jmp draw_wd
no_dn:
 
cmp ah,15
jne no_copyclip ;copy to clipboard
copy_to_clip:
mov ebx,param_area ;clipfilp
mov eax,32
int 0x40
mov esi,0
wlll2:
mov al,byte [path+esi]
cmp al,byte '/'
jne wfis2
inc esi
cmp esi,12*20
jnae wlll2
jmp still
wfis2:
mov al,byte [path+esi]
cmp al,byte ' '
je waa2
inc esi
cmp esi,12*20
jnae wfis2
jmp still
waa2:
mov eax,[filecursor]
mov ebx,62
mul ebx
mov edi,eax
cmp [convinfo+edi+26],dword 'FOL '
je still
mov ecx,12*20
wlopt:
mov al,[path+ecx]
mov [paramtest+ecx],al
dec ecx
jns wlopt
mov [paramtest+esi],byte '/'
inc esi
mov ebp,8+4
mov edx,edi
wlosf:
mov al,[convinfo+edi]
mov [paramtest+esi],al
inc esi
inc edi
dec ebp
jnz wlosf
mov [paramtest+esi],byte 0
mov ebx,param_area ;clipfile
mov ecx,paramtest
mov edx,100
mov esi,0
mov eax,33
int 0x40
jmp still
no_copyclip:
 
cmp ah,16
jne no_clippaste
paste_from_clip:
mov ebx,param_area ;clipfile
mov ecx,0
mov edx,-1
mov esi,sourcepath
mov eax,6
int 0x40
 
mov ecx,99
cdestp:
mov al,[path+ecx]
mov [destpath+ecx],al
dec ecx
jns cdestp
 
mov esi,0
zlll2:
mov al,byte [destpath+esi]
cmp al,byte '/'
jne zfis2
inc esi
cmp esi,100
jnae zlll2
jmp still
zfis2:
mov al,byte [destpath+esi]
cmp al,byte ' '
je zaa2
inc esi
cmp esi,100
jnae zfis2
jmp still
zaa2:
mov byte [destpath+esi],'/'
inc esi
 
mov edi,0
qlll2:
mov al,byte [sourcepath+edi]
cmp al,byte '.'
je qfis2
inc edi
cmp edi,100
jnae qlll2
jmp still
qfis2:
sub edi,8 ;.-8=start of file name
 
mov ecx,11 ;11 sybols
cfname:
mov al,[sourcepath+edi]
cmp al,byte ' '
je dar
mov [destpath+esi],al
inc esi
dar:
inc edi
dec ecx
jns cfname
 
; mov [destpath+esi],byte 0
 
mov ecx,199
cdestjp:
mov al,[sourcepath+ecx]
cmp al,byte 0
jne nor
mov al,byte 32
nor:
mov [sourcepath+ecx],al
dec ecx
jns cdestjp
 
cmp [browser],dword 1
jne no_outpath
mov eax,4 ; function 4 : write text to window
mov ebx,10*65536+67 ; [x start] *65536 + [y start]
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
mov edx,sourcepath ; pointer to text beginning
mov esi,100 ;12*20 ; text length
int 0x40
mov ebx,250*65536+67 ; [x start] *65536 + [y start]
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
mov edx,destpath ; pointer to text beginning
mov esi,100 ;12*20 ; text length
int 0x40
no_outpath:
 
mov ebx,copyrfile
mov ecx,sourcepath
mov eax,19
int 0x40
delay 50 ;wait recoed file
jmp update ;still
no_clippaste:
 
cmp ah,19 ;Delete from floppy
delete_file:
jne no_delt
cmp dword [path],'/RD/'
jne no_delt
cmp byte [path+4],'1'
jne no_delt
 
mov eax,[filecursor]
mov ebx,62
mul ebx
mov edi,eax
add edi,convinfo
mov ebp,edi
mov eax,dword [edi]
mov dword [paramtest],eax
mov eax,dword [edi+4]
mov dword [paramtest+4],eax
mov eax,dword [edi+4+4+1]
mov dword [paramtest+4+4],eax
 
mov ebx,paramtest
mov eax,32
int 0x40
jmp update
no_delt:
 
cmp ah,20 ;I - Help
je help_scr
 
cmp ah,22
jne no_headfile
mov [drawhf],1
call draw_window
mov [drawhf],0
mov [pmenu_draw],1
jmp still
no_headfile:
 
cmp ah,23
jne no_headview
mov [drawhv],1
call draw_window
mov [drawhv],0
mov [pmenu_draw],1
jmp still
no_headview:
 
cmp ah,24
jne no_headinfo
mov [drawhi],1
call draw_window
mov [drawhi],0
mov [pmenu_draw],1
jmp still
no_headinfo:
 
;FILE MENU
cmp ah,30
je kfad
 
cmp ah,31
je copy_to_clip ;Copy
 
cmp ah,32
je paste_from_clip ;Paste
 
cmp ah,33
je delete_file ;Delte
 
cmp ah,34
je textopen ;Edit in Tinypad
 
cmp ah,37
je exit
 
;VIEW MENU
cmp ah,40 ;Sort by name show del
jne no_sn
; mov dword [viewmode],0
and dword [viewmode],100b
jmp update
no_sn:
 
cmp ah,41 ;Sort by extension show del
jne no_se
and dword [viewmode],1101b
or dword [viewmode],0001b
jmp update
no_se:
 
cmp ah,42 ;Sort by size show del
jne no_ss
and dword [viewmode],1110b
or dword [viewmode],0010b
jmp update
no_ss:
 
cmp ah,43 ;Sort by date show del
jne no_sd
or dword [viewmode],0011b
jmp update
no_sd:
 
cmp ah,44 ;Show del files
jne no_ds
or dword [viewmode],0100b
jmp update
no_ds:
 
cmp ah,45 ;Fade del files
jne no_df
and dword [viewmode],11111011b
jmp update
no_df:
 
;HELP MENU
cmp ah,50 ;Help?
je help_scr
 
cmp ah,51 ;Info?
je info_scr
 
cmp ah,83
ja no_hd_part
cmp ah,80
jb no_hd_part
mov ecx,0
sub ah,80
inc ah
mov cl,ah
mov eax,21
mov ebx,8 ;7
int 0x40
 
no_hd_part:
 
cmp ah,1 ; test on exit button
je exit
 
jmp still
 
exit:
; //// Willow
mov eax,58
mov ebx,MRUfile
mov dword[ebx+8],255
inc dword[ebx]
int 0x40
; //// Willow
mov eax,-1
int 0x40
 
draw_wd:
; call draw_window
; jmp still
mov [flick],1
jmp anti_flick
 
edit_prompt:
not [focus]
jmp red
 
help_scr:
mov esi,14
mov ebp,help_text
jmp screen
 
info_scr:
mov esi,6
mov ebp,info_text
jmp screen
 
screen:
cmp [browser],dword 1 ;it's browser?
jne dialogscr
 
mov eax,[procinfo.y_size]
sub eax,90
drawfbox 40,76,300,eax,0x00000000
mov eax,[procinfo.y_size]
sub eax,92
drawfbox 41,77,298,eax,0x00ffffff
mov edi,esi ;14
mov ebx,(41+26)*65536+(77+20)
mov ecx,cl_Black
mov edx,ebp ;help_text
jmp outlab
 
dialogscr:
mov eax,[procinfo.y_size]
sub eax,84
drawfbox 16,54,270,eax,0x00000000
mov eax,[procinfo.y_size]
sub eax,86
drawfbox 17,55,268,eax,0x00ffffff
mov edi,esi ;14
mov ebx,(17+10)*65536+(55+1)
mov ecx,cl_Black
mov edx,ebp ;help_text
 
outlab: ;out labels
mov eax,4
mov esi,40
helploo:
int 0x40
add ebx,11
add edx,40
dec edi
jnz helploo
 
setimg 48,84,logoinfimg
 
jmp still
 
;HELP TEXT
help_text:
;0123456789012345678901234567890123456789
db ' ~~~~~ SYSTEM X-TREE ~~~~~ '
db ' HELP '
db ' '
db ' '
db 'F2 - CHANGE SORTMODE (name,ext,size,dat)'
db 'F3 - VIEW file in tinypad '
 
db 'F5 - COPY FILE to clipboard '
db 'F6 - PASTE FILE from clipboard '
db 'F11- EDIT PROMPT string '
db 'F12- UPDATE directory sources '
db ' '
 
db 'Enter - input to directory '
db 'Backspace - back to previos directory '
db 'PageDn/PageUp, Up/Down - move cursor '
 
info_text:
db ' ~~~~~ SYSTEM X-TREE ~~~~~ '
db ' INFO 81 Ver '
db ' '
db ' Create by Pavlushin Evgeni '
db ' with ASCL libary special for Menuet OS '
db ' www.deck4.narod.ru waptap@mail.ru '
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; ******** FILE BROWSER / DIALOG *********
 
;draw_browser_window:
 
draw_window:
 
; mov eax,9
; mov ebx,procinfo
; mov ecx,-1
; int 0x40
; mov eax,[procinfo.x_size]
; cmp eax,66
; jg temp12345
; ret
; temp12345:
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
 
mov eax,[sc.work_button]
mov [b_color],eax
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
;Window
 
xor eax,eax ; function 0 : define and draw window
 
cmp [browser],dword 1 ;it's browser
jne nob1
mov ebx,140*65536+400 ; [x start] *65536 + [x size]
mov ecx,160*65536+280 ; [y start] *65536 + [y size]
jmp isb1
nob1:
mov ebx,140*65536+320 ; [x start] *65536 + [x size]
mov ecx,260*65536+240 ; [y start] *65536 + [y size]
isb1:
; mov edx,[sc.work] ; color of work area RRGGBB
or edx,0x03ffffff;000000
int 0x40
 
;Get proc info
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
mov eax,[procinfo.x_size]
cmp eax,66
jg temp12345
ret
temp12345:
 
cmp [browser],dword 1 ;it's browser
jne nob9
mov [listx],120
mov eax,[procinfo.x_size]
sub eax,[listx]
sub eax,7
mov [listxsize],eax
mov [listy],73
mov eax,[procinfo.y_size]
sub eax,[listy]
sub eax,7
mov [listysize],eax
jmp isb9
nob9:
mov [listx],10
mov eax,[procinfo.x_size]
sub eax,[listx]
sub eax,7
mov [listxsize],eax
mov [listy],54
mov eax,[procinfo.y_size]
sub eax,[listy]
sub eax,34
mov [listysize],eax
isb9:
 
 
;Draw only browser components
cmp [browser],dword 1 ;it's browser
jne nob2
 
mov eax,[sc.grab_text] ; color of text RRGGBB
or eax,0x10000000
label 8,8,'SYSTEM X-TREE FILE BROWSER',eax
 
;Draw buttons headers
mov eax,8
mov ebx,8*65536+(6*8-1) ;start pos x
mov ecx,23*65536+10 ;start pos y
mov edx,22;+1000000000000000000000000000000b ;spoke butt
mov edi,3 ;draw 13 button's
mov esi,0x00339933
int 0x40
dec edi
nexthbut:
add ebx,(6*8)*65536
inc edx
int 0x40
dec edi
jnz nexthbut
 
;DRAW PARTITION BUTTONS
mov eax,8
mov ebx,340*65536+5 ;start pos x
mov ecx,24*65536+8 ;start pos y
mov edx,80;+1000000000000000000000000000000b ;spoke butt
mov edi,4 ;draw 13 button's
mov esi,0x00339933
int 0x40
dec edi
nextpbut:
add ebx,6*65536
inc edx
int 0x40
dec edi
jnz nextpbut
 
;DRAW PARTITON TEXT
label 341,25,'1234',cl_White;Black
 
;File STRING
label 8,25,' FILE VIEW INFO ', ;cl_White ;Black
 
;BlackLine
mov eax,[procinfo.x_size]
sub eax,10
drawfbox 5,35, eax, 1, cl_Black
 
;BlackLine2
mov eax,[procinfo.x_size]
sub eax,10
drawfbox 5,68, eax, 1, cl_Black
 
;BlackLine2 vertical
; mov eax,[procinfo.y_size]
; sub eax,69+4
; drawfbox 115, 69, 1, eax, cl_Black
 
;Set logo img
setimg 34,88,logoinfimg
label 20,165,'SYSTEM X-TREE',cl_Black
add ebx,10
label ,,'FOR MENUETOS',
 
add ebx,9*65536+20
label ,,'welcome to',cl_Green
add ebx,-15*65536+10
label ,,'www.menuetos.org',cl_Green
 
; label ,,'Create by',cl_Green
; add ebx,10
; label ,,' Pavlushin',
; add ebx,10
; label ,,' Evgeni',
 
 
;Draw head->file buttons
cmp [drawhf],1
jne no_drawhf
mov ebx,8*65536+6*12 ;start pos x
mov ecx,35*65536+10 ;start pos y
mov edx,30 ;spoke butt
mov edi,8 ;draw 4 button's
mov esi,cl_Grey
call menubutton
no_drawhf:
 
;Draw head->view buttons
cmp [drawhv],1
jne no_drawhv
mov ebx,(8+6*8)*65536+6*12 ;start pos x
mov ecx,35*65536+10 ;start pos y
mov edx,40 ;spoke butt
mov edi,6 ;draw 4 button's
mov esi,cl_Grey
call menubutton
no_drawhv:
 
;Draw head->info buttons
cmp [drawhi],1
jne no_drawhi
mov ebx,(8+12*8)*65536+6*12 ;start pos x
mov ecx,35*65536+10 ;start pos y
mov edx,50 ;spoke butt
mov edi,2 ;draw 2 button's
mov esi,cl_Grey
call menubutton
no_drawhi:
 
nob2:
 
;Draw buttons instruments
mov eax,8
cmp [browser],dword 1 ;it's browser
jne nob3
mov ebx,10*65536+16+5 ;start pos x
mov ecx,37*65536+15 ;start pos y
jmp isb3
nob3:
mov ebx,16*65536+16+5 ;start pos x
mov ecx,29*65536+15 ;start pos y
isb3:
mov edx,8;+1000000000000000000000000000000b ;spoke butt
mov edi,13 ;draw 13 button's
mov esi,cl_Grey
int 0x40
dec edi
nextbut:
add ebx,(16+6)*65536
inc edx
int 0x40
dec edi
jnz nextbut
 
 
cmp [browser],dword 1 ;it's browser
jne nob4
;But img browser
setimg 10,37,butimg
;left logo
add eax,[procinfo.x_size]
sub eax,80
mov [temp],eax
setimg [temp],37,logoimg
jmp isb4
nob4:
;But img dialog
setimg 16,29,butimg
isb4:
 
cmp [browser],dword 1 ;it's browser
jne nob5
 
mov [urlx],48
mov [urly],55
mov eax,[procinfo.x_size]
sub eax,48+10
mov [urlxsize],eax
mov [urlysize],12
 
label 20,57,"URL:",cl_Black
 
;Out view mode info
mov eax,[viewmode]
mov ebx,16
mul ebx
mov edx,eax
mov eax,4
mov ebx,180*65536+25
mov ecx,cl_Black
add edx,modetext
mov esi,16
int 0x40
 
;List size
outcount [listsize],294,25,cl_Black,4*65536
jmp isb5
 
head_dlg: db 'OPEN FILE'
db 'SAVE FILE'
but_dlg: db 'OPEN'
db 'SAVE'
 
nob5:
 
mov [urlx],10
mov eax,[procinfo.y_size]
sub eax,24
mov [urly],eax
mov eax,[procinfo.x_size]
sub eax,80
mov [urlxsize],eax
mov [urlysize],12
 
cmp byte [dlg_type],'O' ;if byte O - is Open dialog
jne no_openh
mov edx,head_dlg ;draw in head OPEN FILE
jmp out_laby
no_openh:
cmp byte [dlg_type],'S' ;if byte S - is Save dialog
jne no_saveh
mov edx,head_dlg+9 ;draw in head SAVE FILE
out_laby:
mov ebx,8*65536+8
mov ecx,[sc.grab_text] ; color of text RRGGBB
or ecx,0x10000000
mov esi,9
mov eax,4
int 0x40
no_saveh:
 
 
;Draw OPEN\SAVE button
mov ebx,0*65536+50
mov ecx,0*65536+12
mov eax,[procinfo.x_size]
sub eax,63
shl eax,16
add ebx,eax
mov eax,[procinfo.y_size]
sub eax,25
shl eax,16
add ecx,eax
mov eax,8
mov edx,5 ;button ID
mov esi,0x006699aa ;gradient!!!
int 0x40
 
; label OPEN or SAVE
mov ebx,[procinfo.x_size]
sub ebx,48
mov eax,[procinfo.y_size]
sub eax,22
shl ebx,16
add ebx,eax
 
cmp byte [dlg_type],'O' ;if byte O - is Open dialog
jne no_openb
mov edx,but_dlg ;draw in head OPEN FILE
jmp out_labx
no_openb:
cmp byte [dlg_type],'S' ;if byte S - is Save dialog
jne no_saveb
mov edx,but_dlg+4 ;draw in head SAVE FILE
out_labx:
mov ecx,cl_White
mov esi,4
mov eax,4
int 0x40
no_saveb:
 
isb5:
 
anti_flick:
 
cmp [flick],2
je draw_url
cmp [flick],0
jne no_flick_url
 
;***************************
; DRAW URL LINE
;***************************
draw_url:
 
;Draw URL focus button
mov ebx,[urlx]
shl ebx,16
add ebx,[urlxsize]
mov ecx,[urly]
shl ecx,16
add ecx,[urlysize]
dec ebx
dec ecx
mov eax,8
mov edx,2 ;button ID
mov esi,0x00aaaaaa ;gradient!!!
int 0x40
 
;Draw URL String
mov eax,13
mov edx,cl_Black
int 0x40
add ebx,1*65536-2+1
add ecx,1*65536-2+1
mov edx,cl_White
int 0x40
 
;Draw URL Cursor
mov eax,6
mul [cursor]
mov ebx,[urlx]
add ebx,eax
shl ebx,16
add ebx,2*65536+1
mov ecx,[urly]
shl ecx,16
add ecx,[urlysize]
add ecx,2*65536-4
mov eax,13
mov edx,cl_Black
int 0x40
 
; OUT TEXT
mov eax,[urlxsize] ;calculating text leight
sub eax,8
mov ebx,6
div ebx
mov esi,eax
 
mov ebx,[urlx]
shl ebx,16
add ebx,[urly]
add ebx,3*65536+2
mov eax,4 ; function 4 : write text to window
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
mov edx,path ; pointer to text beginning
int 0x40
 
cmp [flick],2
jne no_flick_url
mov [flick],0
jmp still
no_flick_url:
 
 
;***************************
; DRAW FILE LIST
;***************************
 
;Draw Scroll Line
mov eax,13
 
mov ebx,[listx]
add ebx,[listxsize]
sub ebx,[scrollsize]
shl ebx,16
add ebx,dword [scrollsize]
mov ecx,[listy]
add ecx,[scrollbutsize]
shl ecx,16
add ecx,[listysize]
sub ecx,[scrollbutsize]
sub ecx,[scrollbutsize]
mov edx,[scrollcolor] ;0x00006600
int 0x40
 
;Draw Scroll Box
mov edx,0
mov eax,[listysize]
sub eax,2
mov ebx,dword 10
div ebx
 
mov edx,0
mov ebx,eax
cmp ebx,[listsize] ;filelistsize in ebx
ja notusescroll
;usescroll
mov eax,[listysize]
sub eax,[scrollbutsize]
sub eax,[scrollbutsize]
shl eax,16
div dword [listsize]
mul ebx
shr eax,16
mov esi,[mousey]
shl esi,16
add esi,eax
 
mov eax,13
mov ebx,[listx]
add ebx,[listxsize]
sub ebx,[scrollsize]
shl ebx,16
add ebx,dword [scrollsize]
mov ecx,[listy]
add ecx,[scrollbutsize]
shl ecx,16
add ecx,esi
mov edx,[scrollboxcol]
int 0x40
notusescroll:
 
 
;Draw list button for get file name
mov ebx,[listx]
shl ebx,16
add ebx,[listxsize]
sub ebx,15 ;right free zone
sub ebx,[scrollsize]
mov ecx,[listy]
shl ecx,16
add ecx,[listysize]
 
mov eax,8
mov edx,4+1000000000000000000000000000000b ;spoke butt
int 0x40
 
add ebx,15
mov eax,13
mov edx,[listcolor] ;ffffff
int 0x40
 
;Draw up/down buttons
mov ebx,[listx]
add ebx,[listxsize]
sub ebx,[scrollsize]
shl ebx,16
add ebx,[scrollsize]
mov ecx,[listy]
shl ecx,16
add ecx,[scrollbutsize]
dec ecx ;correction
mov eax,8
mov edx,6+1000000000000000000000000000000b ;spoke butt
int 0x40
 
inc ecx
mov eax,13
mov edx,[scrollbutcol] ;ffffff
int 0x40
 
; Draw image on up button
pushad
shr ebx,16
mov edx,ebx
shl edx,16
shr ecx,16
add edx,ecx
mov ecx,8*65536+9
mov ebx,upsb+8
mov eax,7
int 0x40
popad
 
 
dec ecx ;correction
mov edx,7+1000000000000000000000000000000b ;spoke butt
mov eax,[listysize]
sub eax,[scrollbutsize]
shl eax,16
add ecx,eax
 
mov eax,8
int 0x40
 
inc ecx
mov eax,13
mov edx,[scrollbutcol] ;ffffff
int 0x40
 
; Draw image on down button
pushad
shr ebx,16
mov edx,ebx
shl edx,16
shr ecx,16
add edx,ecx
mov ecx,8*65536+9
mov ebx,dnsb+8
mov eax,7
int 0x40
popad
 
 
; Draw text in file list
 
mov eax,[listxsize]
sub eax,40*6 ;leight of string
shr eax,1
add eax,[listx]
shl eax,16
add eax,[listy]
add eax,2
 
mov [filelistxy],eax ;dword 19*65536+58
 
mov edx,0
mov eax,[listysize]
sub eax,2
mov ebx,dword 10
div ebx
mov [filelistsize],eax ;dword 40
 
; OUT FILE DATA
mov eax,[filecursor] ;calc cursor position
mov ebx,62
mul ebx
 
;OUT TEXT
mov ebp,4096 ; 16 ;out strings process
sub ebp,[filecursor]
mov edx,convinfo ;fileinfo+11
add edx,eax
mov ebx,dword [filelistxy]
loo:
mov ecx,0x00888888 ;for another file's color white
cmp [edx+26],dword 'FOL ' ;folder yellow
jne nb
mov ecx,0x00006666
jmp cset1
nb:
mov eax,[edx+8]
;Color set
cmp eax,dword '.TXT' ;text's blue
je itx
cmp eax,dword '.INC'
je itx
cmp eax,dword '.ASM'
je itx
jmp nt
itx:
mov ecx,0x00446666
jmp cset
nt:
cmp eax,dword '.BMP' ;picture's pure
je ipic
cmp eax,dword '.JPG'
je ipic
cmp eax,dword '.JPE'
je ipic
cmp eax,dword '.GIF'
je ipic
; //// Willow
cmp eax,dword '.PNG'
je ipic
; //// Willow
cmp eax,dword '.WAV'
je ipic
jmp np
ipic:
mov ecx,0x00226688
jmp cset
np:
cmp eax,dword '. ' ;execute's green
jne nexec
mov ecx,0x00008866
jmp cset
nexec:
cset:
 
cset1:
mov esi,40 ;symbols out 62 ;32
mov eax,4
pushad
int 0x40
; popad
 
; pushad
cmp [edx+26],dword 'Fvol' ;volume label
jne no_volico
push hdico+8
jmp out_ico
no_volico:
cmp [edx+26],dword 'FOL '
jne no_folico
cmp [edx+9],dword 'HARD'
jne no_hdico
push hdico+8
jmp out_ico
no_hdico:
cmp [edx+9],dword 'RAMD'
jne no_rdico
push rdico+8
jmp out_ico
no_rdico:
push folico+8
jmp out_ico
no_folico:
cmp [edx+8],dword '.BMP'
je is_imgico
cmp [edx+8],dword '.JPG'
je is_imgico
cmp [edx+8],dword '.JPE'
je is_imgico
cmp [edx+8],dword '.GIF'
je is_imgico
; //// Willow
cmp [edx+8],dword '.PNG'
je is_imgico
; //// Willow
cmp [edx+8],dword '.WAV'
je is_imgico
jmp no_imgico
is_imgico:
push imgico+8
jmp out_ico
no_imgico:
cmp [edx+8],dword '.ASM'
je is_asmincico
cmp [edx+8],dword '.INC'
je is_asmincico
jmp no_asmincico
is_asmincico:
push asmincico+8
jmp out_ico
no_asmincico:
cmp [edx+8],dword '.TXT'
jne no_txtico
push txtico+8
jmp out_ico
no_txtico:
cmp [edx+8],dword '. '
jne no_execico
push execico+8
jmp out_ico
no_execico:
cmp [edx+26],dword 'DAT '
jne no_datico
push datico+8
jmp out_ico
no_datico:
cmp [edx+26],dword 'DEL '
jne no_out_ico
push delico+8
jmp out_ico
out_ico:
 
mov edx,ebx
sub edx,14*65536+1
mov ecx,12*65536+9
; mov ebx,upsb+8
pop ebx
mov eax,7
int 0x40
no_out_ico:
popad
 
 
add ebx,10
noout:
add edx,62
 
dec [filelistsize]
cmp [filelistsize],dword 0
je extloo
 
dec ebp
jnz loo
dext:
mov [downstop],1
 
extloo:
 
cmp [browser],dword 1 ;it's browser
jne nob8
 
;Draw text for head->file buttons
cmp [drawhf],1
jne no_drawhftext
drawfbox 8,35,(6*12)+1,11*8,0x00000000
drawfbox 9,36,(6*12)-1,(11*8)-2,0x00ffffff
 
mov edi,8
mov ebx,9*65536+37
mov ecx,cl_Black
mov edx,file_text_label
call drawmenu
jmp no_drawhftext
 
file_text_label:
db ' Open '
db ' Copy '
db ' Paste '
db ' Delete '
db ' Tinypad '
db ' Edit '
db ' '
db ' Exit '
 
no_drawhftext:
 
;Draw text for head->view buttons
cmp [drawhv],1
jne no_drawhvtext
drawfbox (8+6*8),35,(6*12)+1,(11*6),0x00000000
drawfbox (9+6*8),36,(6*12)-1,(11*6)-2,0x00ffffff
 
mov edi,6 ;4
mov ebx,(9+6*8)*65536+37
mov ecx,cl_Black
mov edx,view_text_label
call drawmenu
jmp no_drawhvtext
 
view_text_label:
db ' Name sort '
db ' Ext. sort '
db ' Size sort '
db ' Date sort '
db ' Show DEL '
db ' Fade DEL '
 
no_drawhvtext:
 
;Draw text for head->info buttons
cmp [drawhi],1
jne no_drawhitext
drawfbox (8+12*8),35,(6*12)+1,(11*2),0x00000000
drawfbox (9+12*8),36,(6*12)-1,(11*2)-2,0x00ffffff
 
mov edi,2
mov eax,4
mov ebx,(9+12*8)*65536+37
mov ecx,cl_Black
mov edx,info_text_label
call drawmenu
jmp no_drawhitext
 
info_text_label:
db ' Help '
db ' About '
 
no_drawhitext:
 
nob8:
cmp [flick],1
jne no_flick
mov [flick],0
jmp still
no_flick:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
;FILE LIST PARAMETRS
 
listx dd 15
listy dd 72
listxsize dd 350
listysize dd 41
 
filelistxy dd 0
filelistsize dd 0
scrollsize dd 8
listcolor dd 0xffffff ;0xeeeeee
scrollcolor dd 0x778877
scrollboxcol dd 0x335533
scrollbutcol dd 0x224422
scrollbutsize dd 9
usescroll dd 1
 
;URL LINE PARAMETRS
 
urlx dd 10
urly dd 20
urlxsize dd 350
urlysize dd 12
 
 
drawmenu:
mov eax,4
mov esi,12
menuloo:
int 0x40
add ebx,11
add edx,12
dec edi
jnz menuloo
ret
 
menubutton:
mov eax,8
nextmenubut:
int 0x40
add ecx,11*65536
inc edx
dec edi
jnz nextmenubut
ret
 
;*****************************
; READ FILE STRUCTURE PROC
;*****************************
 
read_directory:
 
; STEP 0 SEt TYPE OF SORT
 
mov eax,[viewmode]
;with no show del files
and eax,0FFFFFFFBh
cmp eax,0
jnz no_sort_by_name
mov [start],0
mov [x0],12
mov [x1],99
mov [x2],99
mov [x3],99
jmp sortset
 
no_sort_by_name:
dec eax
jnz no_sort_by_ext
mov [start],9
mov [x0],9
mov [x1],99
mov [x2],99
mov [x3],12
jmp sortset
 
no_sort_by_ext:
dec eax
jnz no_sort_by_size
mov [start],30
mov [x0],12
mov [x1],99
mov [x2],99
mov [x3],38
jmp sortset
 
no_sort_by_size:
dec eax
mov [start],21
mov [x0],12
mov [x1],17
mov [x2],20
mov [x3],26
jmp sortset ;sort by date
 
;SORT VARILE
start dd 0
x0 dd 0
x1 dd 0
x2 dd 0
x3 dd 0
 
sortset:
 
;STEP 1 CLEAR CONVINFO
mov edi,convinfo
mov al,255
mov ecx,4096*62 ;512
cld
rep stosb
 
;STEP 2 TEST ON HD OR PARTITION
cmp [path],byte '/'
je nstep
mov ecx,61+62
loxhd:
mov al,[hdimg+ecx]
mov [convinfo+ecx],al
dec ecx
jns loxhd
mov [listsize],0
ret
nstep:
cmp [path+3],byte '/'
je nstep2
mov ecx,61+62
loxpt:
mov al,[ptimg+ecx]
mov [convinfo+ecx],al
dec ecx
jns loxpt
mov [listsize],0
ret
nstep2:
 
;STEP 3 CLEAR OUTINFO
mov edi,outinfo ;0x14000 ;0x20000
xor eax,eax
mov ecx,4096*32 ;512
cld
rep stosb
 
;STEP 4 READ DATA FROM HD
mov dword [farea],outinfo
mov dword [readblock],0
 
loorhd:
mov eax,[readblock]
mov [fileinfoblock+4],eax
mov eax,58
mov ebx,fileinfoblock
int 0x40
cmp eax,0
jne hd_err
add dword [farea],512
inc dword [readblock]
cmp dword [readblock],4096/16
jna loorhd
 
hd_err:
mov ebx,dword [readblock]
shl ebx,4
mov dword [blocksread],ebx ; for quick resorting
 
cmp eax,5
je end_of_dir
 
; It's erorr's test is poor code
 
cmp eax,1
jne no_inv_part
label 10,10,'Invalid partition or hd base',cl_Red+font_Big
jmp end_of_dir
no_inv_part:
cmp eax,3
jne no_unk_fs
label 10,10,'Unknow file system',cl_Red+font_Big
jmp end_of_dir
no_unk_fs:
 
end_of_dir:
mov [dirlen],ebx
 
; command succesful
 
mov esi,outinfo ;data_area+1024
; mov edi,fileinfo+11
mov edx,0 ;4096 ;16
 
newlineb:
 
mov edi,fileinfo+11
 
pushad ; clear
mov al,32
mov ecx,58
sub edi,11
cld
rep stosb
popad
 
mov cl,[esi] ; end of entries ?
cmp cl,6
jnz noib0
 
mov [edi+26],dword 'EOE '
add esi,32
; add edi,62
jmp inf
 
noib0:
 
mov cl,[esi+0]
cmp cl,0xe5
je yesdelfil
 
mov cl,[esi+11] ; long fat32 name ?
cmp cl,0xf
jnz noib1
 
mov [edi+26],dword 'F32 '
add esi,32
; add edi,62
jmp inf
 
noib1:
 
mov eax,'DAT ' ; data or .. ?
 
mov cl,[esi+0] ; deleted file
cmp cl,0xe5
je yesdelfil
cmp cl,0x0
je yesdelfil
jmp nodelfil
yesdelfil:
mov eax,'DEL '
jmp ffile
 
nodelfil:
 
mov cl,[esi+11] ; folder
and cl,0x10
jz ffile
mov eax,'FOL '
mov [edi+26],eax
jmp nosize
ffile:
 
; Asko patch for v79
mov cl,[esi+11] ; fold
and cl,0xf
cmp cl,0xf ; skip long filename
jz novol
test cl,0x8 ; is it fold label?
jz novol ; no
mov eax,'Fvol'
mov [edi+26],eax
jmp nosize
novol:
 
mov [edi+26],eax
 
pusha ; size
mov eax,[esi+28]
mov esi,edi
add esi,37
mov ebx,10
mov ecx,8
newnum:
xor edx,edx
div ebx
add dl,48
mov [esi],dl
test eax,eax
jz zernum
dec esi
loop newnum
zernum:
popa
nosize:
 
pusha ; date
mov [edi+17],dword '. .'
 
movzx eax,word [esi+24]
shr eax,9 ; year
add eax,1980
mov ecx,4
newdel1:
dec ecx
xor edx,edx
mov ebx,10
div ebx
add edx,48
mov [edi+ecx+21],dl
test ecx,ecx
jnz newdel1
 
movzx eax,word [esi+24]
shr eax,5 ; month
and eax,0x0f
mov ecx,2
newdel2:
dec ecx
xor edx,edx
mov ebx,10
div ebx
add edx,48
mov [edi+ecx+18],dl
test ecx,ecx
jnz newdel2
 
movzx eax,word [esi+24]
and eax,0x1f ; day
mov ecx,2
newdel3:
dec ecx
xor edx,edx
mov ebx,10
div ebx
add edx,48
mov [edi+ecx+15],dl
test ecx,ecx
jnz newdel3
 
popa
 
 
pusha ; number
mov eax,edx
sub eax,4096
neg eax
 
xor edx,edx
mov ebx,10
div ebx
add dl,48
mov [edi+43],dl ;0001
xor edx,edx
div ebx
add dl,48
mov [edi+42],dl ;0010
xor edx,edx
div ebx
add al,48
add dl,48
mov [edi+41],dl ;0100
mov [edi+40],byte 0 ;1000
popa
 
mov ecx,8 ; first 8
cld
rep movsb
mov [edi],byte '.'
inc edi
mov ecx,3 ; last 3
cld
rep movsb
 
add esi,(32-11)
; add edi,(60-12+2)
 
inf:
 
pushad
 
;STEP 5 Test on WRITE OR NOTWRITE
mov edx,fileinfo+11
looo:
 
; Delete del, eoe, f32 and another head-names
cmp [viewmode],3 ;0-3 no outdel
ja del_out
cmp [edx+26],dword 'DEL '
je nextfl
del_out:
cmp [edx+26],dword 'DEL '
jne no_del
cmp [edx],dword 0 ;431 ;435 ;484 +10% speed
je nextfl
no_del:
cmp [edx+26],dword 'EOE '
je nextfl
cmp [edx+26],dword 'F32 ' ;F32 not useles
je nextfl
cmp [edx],dword '. '
je nextfl
cmp [edx],dword '.. '
je nextfl
cmp [edx],dword 'FIRS'
je nextfl
 
; ---------_______-------_______ --------_________-----------
; SORT by name and del deletet files or f32 headers from list
; _________-------_______ --------_______---------___________
 
; STEP 6 UNIVERSAL SORT ALGORYTHM
 
xxx:
mov esi,0 ;[tekfilename] ;0
mov ebx,[start] ; 0
 
; At first Fold after Dat and Del
 
ftestname:
cmp byte [fileinfo+11+26],'F'
je F
cmp byte [fileinfo+11+26],'D'
je D
jmp add_element
D: cmp byte [convinfo+esi+26],'D'
je add_element
cmp byte [convinfo+esi+26],'F'
je skipfile
jmp add_element
F: cmp byte [convinfo+esi+26],'D'
je writenow
; cmp byte [convinfo+esi+26],'F'
; je add_element
; jmp add_element
 
add_element:
mov al,[fileinfo+ebx+11]
cmp al,[convinfo+esi+ebx]
je equal
jb writenow
skipfile:
add esi,62
mov ebx,[start] ;0
jmp ftestname
 
equal:
inc ebx
cmp ebx,[x0]
je writefile
cmp ebx,[x1]
je x1p
cmp ebx,[x2]
je x2p
cmp ebx,[x3]
jae x3p
jmp add_element
 
x1p:
mov ebx,18
jmp add_element
x2p:
mov ebx,15
jmp add_element
x3p:
mov ebx,0
jmp add_element
 
writenow:
mov ecx,4096*62
sub ecx,esi
ldloop:
mov al,[convinfo+ecx+esi]
mov [convinfo+ecx+esi+62],al
dec ecx
jns ldloop
 
 
writefile:
mov ecx,61
wfloop:
mov al,[fileinfo+ecx+11]
mov [convinfo+ecx+esi],al
dec ecx
jns wfloop
 
nextfile:
 
nextfl:
; popad
; pushad
mov eax,edx
shl eax,26
cmp eax,0
jne no_outcnt
push edx
drawfbox 294,25,(4*6),10,cl_White
pop ebp
outcount ebp,294,25,cl_Black,4*65536
no_outcnt:
popad
 
inc edx
cmp edx,4096
jnae newlineb
 
 
;STEP 8 GET SIZE OF RESORTING LIST
mov ecx,0
mov edi,0
mov eax,[blocksread]
mov ebx,62
mul ebx
mov edx,eax
loogs:
mov eax,dword [convinfo+edi+26]
cmp eax,dword 0xffffffff
je endgs
add edi,62
inc ecx
cmp edi,edx ;4096*62
jnae loogs
endgs:
mov [listsize],ecx
ret
 
;******************************************************************************
 
; DATA AREA
pmenu_draw dd 0 ;if poup menu is draw,update all window
flick dd 0 ;anti flick on ?
drawhf dd 0 ;draw file menu?
drawhv dd 0 ;draw view menu?
drawhi dd 0 ;draw info menu?
browser dd 0 ;0-dialog, 1-browser
cursor dd 0 ;cursor in prompt line
focus dd 0 ;prompt edit or window?
viewmode dd 0 ;folder sort & not del
downstop dd 0
filecursor dd 0
mousex dd 0
mousey dd 0
blocksread dd 0
listsize dd 0 ;num of files in directory
temp dd 0
readblock dd 1
dlg_type db 0 ;S-save O-open
 
;01234567890123456789012345678901234567890123456789012345678912
hdimg db 'HD HARDDISK FOL '
db 'RD RAMDISK FOL '
 
ptimg db '1 FIRST PARTITION FOL '
db '2 SECOND PARTITION FOL '
 
modetext:
;0123456789012345
db 'SORT BY NAME 0'
db 'SORT BY EXT. 1'
db 'SORT BY SIZE 2' ;type sort
db 'SORT BY DATE 3'
db 'DEL SORT NAME 4'
db 'DEL SORT EXT. 5'
db 'DEL SORT SIZE 6' ;type sort
db 'DEL SORT DATE 7'
 
dirlen dd 0x1
b_color dd 0x6677cc
 
; //// Willow
MRUfile:
dd 0x0
dd 0x0
dd 0x1
dd path
dd tempzone
db '/RD/1/MRU.LST',0
; //// Willow
 
;Name of programs
editor db 'TINYPAD '
bmpview db 'MV '
jpgview db 'JPEGVIEW '
gifview db 'GIFVIEW '
ac97wav db 'AC97WAV '
copyrfile db 'COPYR '
; //// Willow
pngview db '@RCHER '
; //// Willow
 
fileinfo_start:
dd 16
dd 0
dd 0 ;tempzone+1000;
dd 0
dd tempzone ;0x10000
open_path:
times 256 db 0 ;run app path
 
fileinfoblock:
dd 0x0 ; read
dd 0x0 ; first block
dd 0x1 ; number of blocks to read
farea:
dd outinfo ; ret offset
dd tempzone ; work size of sytemram
path:
times 256 db 0 ;path
;rb 256
but_file:
file 'systr12.GIF'
butimg:
rb 400*16*3+8 ;buttons (left pice of picture)
logoimg:
rb 70*16*3+8 ;logo (right pice of picture)
logoinfimg:
rb 60*60*3+8 ;logoinfo (right pice of picture)
upsb:
rb 8*9*3+8 ;up scroll button
dnsb:
rb 8*9*3+8 ;down scroll button
 
;ICONS RESERVE AREA
hdico:
rb 12*9*3+8
rdico:
rb 12*9*3+8
folico:
rb 12*9*3+8
datico:
rb 12*9*3+8
delico:
rb 12*9*3+8
imgico:
rb 12*9*3+8
txtico:
rb 12*9*3+8
asmincico:
rb 12*9*3+8
execico:
rb 12*9*3+8
 
tempimg: ;reserve ram for images
rb 400*100*3+8 ;for picture
rb 8000
 
gif_hash:
rd 4096
tempzone: ;temp zone for 58 function
rb 4000
 
sourcepath rb 100
destpath rb 100
 
MYPID:
rd 8
 
I_END:
 
param_area:
rb 256
paramtest:
rb 256
filedir:
rb 256
 
procinfo process_information
sc system_colors
 
fileinfo:
rb 200 ;4096*62+1024
 
outinfo:
rb 4096*34+1024
 
convinfo:
rb 4096*62+1024
 
RAM_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tanks/trunk/Hi_win.txt
0,0 → 1,31
 
 
 
Hi!My name is andrew_programmer aka Andrey Ignatyev.This my firs programm and game for MenuetOS.
Game TANKS was made specially for MenuetOS.(x.8.2005)
All pictures and levels made i.
I bad speak an english.Please use translater for understanding next text.
 
 
 
Ïðèâåò!Ìåíÿ çîâóò Àíäðåé Èãíàòüåâ(andrew_programmer).
Ïî ïðîñüáå Ñåðãåÿ Êóçüìèíà(Wildwest), ïåðâîé èãðîé,êîòîðóþ ÿ ñîçäàë äëÿ Ìåîñ,
ñòàëà "Òàíêè".Ãðàôèêó íå ñóäèòå ñòðîãî-âñå ðèñîâàë ÿ ñàì,à ïîìî÷ü áûëî íåêîìó.
Êñòàòè,âñå êàðòèíêè áûëè ñîçäàíû èñêëþ÷èòåëüíî â ìåîñü â ìîåì ñîáñòâåííîì ôîðìàòå-pix.
 
 
Öåëü èãðû-ðàçáîìáèòü âñå áàçû ïðîòèâíèêà.Ïîìíèòå,÷òî â âîäå ñêîðîñòü òàíêà çàìåäëÿåòñÿ,
à â äåðåâüÿõ òàíê íåâèäåí.Õîòÿ òàíêè ïðîòèâíèêà íå îòëè÷àþòñÿ îñîáûì èíòåëëåêòîì,íî
âñåðàâíî îíè íå äàäóò âàì ñêó÷àòü.
 
 èãðå çàäóìûâàëîñü ñäåëàòü 32 óðîâíÿ.Íî ó ìåíÿ õâàòèëî ôàíòàçèè òîëüêî íà 15.
Åñëè êòî õî÷åò,ñäåëàéòå åùå 17 ïðèïîìîùè ðåäàêòîðà LevelEdit.Ó íåãî ïðîñòîé èíòåðôåéñ.
Ñòðåëêè ââåðõ,âíèç,âïðàâî,âëåâî óïðàâëÿþò ïîëîæåíèåì øàáëîíà íà êàðòå.Ïðîáåë- ýòî
ñìåíà øàáëîíà(èõ 10).Äëÿ ñîõðàíåíèÿ êàðòû íàæìèòå F2 è ââåäèòå ïîëíûé ïóòü ê ôàéëó âìåñòå
ñ íàçâàíèåì íîâîãî ôàéëà(ïðèìåð:'/hd/1/lev/lev01.lev').Äëÿ çàãðóçêè ñóùåñòâóþùåãî
óðîâíÿ íàæìèòå F1 è ââåäèòå ïóòü ê ôàéëó.Òàíêè ïîÿâëÿþòñÿ ñïðàâà îò áàçû.Âîò è âñå.
 
 
*************************************************************************************************
***************************Íàäåþñü ìîÿ èãðà âàì ïîíðàâèòüñÿ!*************************************
*************************************************************************************************
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tanks/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tanks.asm tanks
@pause
/programs/tanks/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tanks.asm tanks
@pause
/programs/tanks/trunk/lev01.lev
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/tanks/trunk/leveledit.asm
0,0 → 1,1151
use32
org 0x0
 
db 'MENUET01'
dd 0x1
dd START
dd I_END
dd 0x3000+640*400*3+16*20*20*3+512+640+1
dd 0x3000
dd 0x0
dd 0x0
include 'lang.inc'
include 'pixengin.inc'
START:
mov eax,40
mov ebx,111b
int 0x40
call drawwin
;main cycle(fps)
fpst:
call clock
mov eax,[time]
mov [old_time],eax
mov [old_frame_time],eax
;----------------------------------------------------------
;---------load all sprites from arrays to memory-----------
;----------------------------------------------------------
mov [number_sprite],0
xor eax,eax
nextfile:
mov ebx,[spisok+4*eax]
mov ecx,50
mov esi,ebx
add esi,2
mov edi,0x3000+(640*400*3)+(16*20*20*3)+10
rep movsb ;copy palitra to memory
mov esi,ebx
add esi,52
xor ecx,ecx
mov cl,byte [ebx]
mov edi,0x3000+(640*400*3)+(16*20*20*3)+512
push eax
call unpakin
pop eax
mov ecx,20*20
mov esi,0x3000+(640*400*3)+(16*20*20*3)+512
mov edi,[number_sprite]
imul edi,3*20*20
add edi,0x3000+(640*400*3)
un:
xor ebx,ebx
mov bl,byte[esi]
lea ebx,[ebx+ebx*2]
add ebx,0x3000+(640*400*3)+(16*20*20*3)+10
mov edx,[ebx]
mov [edi],edx
add esi,1
add edi,3
sub ecx,1
jnz un
add [number_sprite],1
add eax,1
cmp [number_sprite],10;total number of pictures equal 10
jne nextfile
;--------------------------------------------------------
mov [total_time],0
mov [phas],0
mov [x],100
mov [y],100
animation:
call clock
mov eax,[time]
sub eax,[old_time]
cmp eax,5
jl next_action
mov eax,[time]
mov [old_time],eax
mov eax,[phas]
mov [black],eax
mov [phas],15
call PutSprite
call putimage
mov eax,5
mov ebx,2
int 0x40
mov eax,[black]
mov [phas],eax
call PutSprite
call putimage
call print_pos
add [frames],2
next_action:
call clock
mov eax,[time]
sub eax,[old_frame_time]
cmp eax,100
jl no_frames
mov eax,[time]
mov [old_frame_time],eax
mov eax,13
mov ebx,420*65536+30
mov ecx,425*65536+15
mov edx,0xffffff
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[frames]
mov edx,425*65536+427
mov esi,0
int 0x40
mov [frames],0
no_frames:
;----------------------
mov ebx,20
mov eax,[x]
cdq
idiv ebx
mov ecx,eax
mov eax,[y]
cdq
idiv ebx
imul eax,32
add eax,ecx
add eax,0x3000+(640*400*3)+(16*20*20*3)+512
xor ebx,ebx
mov bl,byte [phas]
mov [eax],bl;write number of shablon to the map-array
;-----------------------
;mov eax,11
;int 0x40
mov eax,23
mov ebx,2
int 0x40
cmp eax,2
jne animation
mov eax,2
int 0x40
shr eax,8
cmp eax,32
jne key2
add [phas],1
cmp [phas],10
jne animation
mov [phas],0
jmp animation
key2:cmp eax,176
jne key3
sub [x],20
jmp animation
key3:cmp eax,179
jne key4
add [x],20
jmp animation
key4:cmp eax,178
jne key5
sub [y],20
jmp animation
key5:cmp eax,177
jne key6
add [y],20
jmp animation
key6: cmp eax,51
jne key7
call save_level
jmp animation
key7:cmp eax,50
jne key8
call load_level
jmp animation
key8:cmp eax,27
jne animation
mov eax,-1
int 0x40
;-------------------------------------------
drawwin:
mov eax,12
mov ebx,1
int 0x40
;à¨á㥬 ®ª­® § ¤ ¢ ï ¢á¥ ­¥®¡å®¤¨¬ë¥ 梥â 
mov eax,0
mov ebx,50*65536+640
mov ecx,50*65536+450
mov edx,0x02AABBCC
mov esi,0x805080d0
mov edi,0x005080d0
int 0x40
;¯¨è¥¬ § £®«®¢®ª ®ª­ 
mov eax,4
mov ebx,5*65536+5
mov ecx,0x10ddeeff
mov edx,name
mov esi,7
int 0x40
;à¨á㥬 ª­®¯ªã § ªàëâ¨ï ®ª­ 
mov eax,8
mov ebx,(640-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x6688dd
int 0x40
ret
;----------------------------------------------------------
counter dd 0
;----------------------------------------------------
;draw sprite in video memory
PutSprite:
mov ebx,[x]
imul ebx,3
mov eax,[y]
imul eax,640*3
add eax,0x3000
add eax,ebx
cld
mov [counter],20
mov esi,[phas]
imul esi,1200
add esi,0x3000+(640*400*3)
mov ebx,esi
draw:
mov esi,ebx
mov edi,eax
mov ecx,20*3
rep movsb
add eax,640*3
add ebx,3*20
dec [counter]
jnz draw
ret
;-------------------------------------------------------------------------
;get time in 1/100 sec
clock: mov eax,26
mov ebx,9
int 0x40
mov [time],eax
ret
;---------------------------------------------------------
putimage:
mov eax,7
mov ebx,0x3000
mov ecx,640*65536+400
mov edx,1*65536+20
int 0x40
ret
;---------------------------------------------------------
print_pos:mov eax,13
mov ebx,490*65536+60
mov ecx,425*65536+15
mov edx,0xffffff
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[x]
mov edx,495*65536+430
mov esi,0
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[y]
mov edx,530*65536+430
mov esi,0
int 0x40
ret
;-----------------------------------------------------------
;-------------------------load files------------------------
;-----------------------------------------------------------
loadfile:
;ªã¤  § ¯¨á뢠âì ¯¥à¢ë© ¡«®ª
mov [file_read+12],dword 0x3000+(640*400*3)+(16*20*20*3)
;§ £à㦠¥¬ ¯¥à¢ë© ¡«®ª ¤«ï ⮣® ç⮡ë 㧭 â à §¬¥à ä ©« 
mov eax,58
mov ebx,file_read
int 0x40
;¢ëç¨á«ï¥¬ ᪮«ìª® ¡«®ª®¢ ¯® 512 ¡ ©â ­ã¦­® ¨á¯®«ì§®¢ âì
;¤«ï § £à㧪¨ ä ©« 
mov ecx,ebx
shr ecx,9
add ecx,1
;§ ¯¨á뢠¥¬  ¤à¥á ªã¤  ­ã¦­® § ¯¨á âì ¯¥à¢ë© ¡«®ª
mov [file_read+12],dword 0x3000+(640*400*3)+(16*20*20*3)
;§ ­®á¨¬ ¢ áâàãªâãàã file_read ­®¬¥à ¡«®ª  á ª®â®à®£® ­ã¦­® § £à㦠âì ä ©«
mov [file_read+4],dword 0
;§ ­®á¨¬ ¢ áâàãªâãàã file_read ç¨á«® ¡«®ª®¢ ª®â®àë¥ ­ã¦­® § £à㧨âì
mov [file_read+8],ecx
;§ £à㦠¥¬ ¡«®ª
mov eax,58
mov ebx,file_read
int 0x40
cmp eax,0
jne scock2
mov esi,0x3000+(640*400*3)+(16*20*20*3)
mov ecx,[esi+8]
add esi,60
mov edi,0x3000+(640*400*3)+(16*20*20*3)+512
call unpakin
mov [addr_palitra],dword 0x3000+(640*400*3)+(16*20*20*3)+10
mov ecx,400
mov esi,0x3000+(640*400*3)+(16*20*20*3)+512
mov edi,[number_sprite]
imul edi,3*20*20
add edi,0x3000+(640*400*3)
unp:
xor eax,eax
mov al,byte[esi]
imul eax,3
add eax,[addr_palitra]
mov ebx,[eax]
and ebx,0xffffff
mov [edi],ebx
add esi,1
add edi,3
sub ecx,1
jnz unp
scock2:
ret
;---------------------------------------------------------------------------
;-----------------save level in file----------------------------------------
;---------------------------------------------------------------------------
save_level:
call input_path
xor ebx,ebx
copy_path:
xor eax,eax
mov al,byte [string+ebx]
cmp al,13
je end_copy
mov [file_write+20+ebx],eax
add ebx,1
jmp copy_path
end_copy:
mov esi,0x3000+(640*400*3)+(16*20*20*3)+512;0x1000+0x1000
mov edi,0x3000+(640*400*3)+(16*20*20*3);0x1000
mov ecx,32*20
call save_image
mov eax,[SizeFile]
mov [file_write+8],eax
mov [file_write+12],dword 0x3000+(640*400*3)+(16*20*20*3);+(0x1000)
mov eax,58
mov ebx,file_write
int 0x40
cmp eax,0
jne scok
xor esi,esi
mov eax,55
mov ebx,eax
mov esi,sound
int 0x40
scok:
ret
;-----------------------------------------------------------------------------
;-----------------load level to memory----------------------------------------
;-----------------------------------------------------------------------------
load_level:
call input_path
xor ebx,ebx
copy_load:xor eax,eax
mov al,byte [string+ebx]
cmp al,13
je end_load
mov [file_read+20+ebx],eax
add ebx,1
jmp copy_load
end_load:
mov [file_read+12],dword 0x3000+(640*400*3)+(16*20*20*3)
mov eax,58
mov ebx,file_read
int 0x40
mov ecx,ebx
shr ebx,9
add ebx,1
mov [file_read+8],ebx
mov eax,58
mov ebx,file_read
int 0x40
cmp eax,0
jne nosound
mov esi,0x3000+(640*400*3)+(16*20*20*3)
mov edi,0x3000+(640*400*3)+(16*20*20*3)+512;0x1000+0x1000
call unpakin
xor esi,esi
mov eax,55
mov ebx,55
mov esi,sound
int 0x40
xor esi,esi
mov [x_l],0
mov [y_l],0
c_y:
mov [x_l],0
c_x:
mov eax,[x_l]
mov ebx,[y_l]
imul ebx,32
add eax,ebx
add eax,0x3000+(640*400*3)+(16*20*20*3)+512;0x1000+0x1000
mov ecx,eax
xor eax,eax
mov al,byte [ecx]
imul eax,1200
add eax,0x3000+(640*400*3)
mov ebx,[x_l]
imul ebx,20*3
mov ecx,[y_l]
imul ecx,20*3*640
add ebx,ecx
add ebx,0x3000
mov esi,eax
mov edi,ebx
;----------------------------
xor edx,edx
next_line:
mov esi,eax
mov edi,ebx
mov ecx,60
rep movsb
add edx,1
add eax,20*3
add ebx,(640*3)
cmp edx,20
jne next_line
;----------------------------
add [x_l],1
cmp [x_l],32
jne c_x
add [y_l],1
cmp [y_l],20
jne c_y
nosound:
jmp animation
;-----------------------------------------------------------------------------
input_path:
mov [position],byte -1
call print_line
mov eax,13
mov ebx,25*65536+6
mov ecx,433*65536+12
mov edx,0xff6c58
int 0x40
opros:mov eax,10
int 0x40
cmp eax,2
jne opros
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je exit_cycle
cmp eax,8
je backspace
cmp eax,176
je left
cmp eax,179
je right
cmp eax,32
je probel
add [position],1
xor ebx,ebx
mov bl,[position]
mov [string+ebx],byte al
call print_line
call print_cursor
jmp opros
backspace:xor ebx,ebx
mov bl,[position]
mov [string+ebx],byte ' '
sub [position],1
call print_line
call print_cursor
jmp opros
left:sub [position],1
call print_line
call print_cursor
jmp opros
right:add [position],1
call print_line
call print_cursor
jmp opros
probel:add [position],1
call print_line
call print_cursor
jmp opros
exit_cycle:add [position],1
xor ebx,ebx
mov bl,[position]
mov [string+ebx],byte 13
mov eax,13
mov ebx,20*65536+(64*6)+5
mov ecx,430*65536+15
mov edx,0xffffff
int 0x40
ret
;---------------------------------------------------------------
print_line:
mov eax,13
mov ebx,20*65536+(64*6)+5
mov ecx,430*65536+15
mov edx,0xffffff
int 0x40
mov eax,4
mov ebx,25*65536+435
mov ecx,0x1
mov edx,string
mov esi,64
int 0x40
ret
print_cursor:
mov eax,13
xor ebx,ebx
mov bl,[position]
imul ebx,6
add ebx,25+6
shl ebx,16
add ebx,6
mov ecx,433*65536+12
mov edx,0xff6c58
int 0x40
ret
;------------------------------------------------------------------------
string:
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
position db 0
total_time dd 0
time dd 0
old_time dd 0
frame dd 0
addr_palitra dd 0
;addr_array dd 0
number_sprite dd 0
offs dd 0
phas dd 0
black dd 0
x dd 0
y dd 0
x_l dd 0
y_l dd 0
name db 'testfps'
frames dd 0
old_frame_time dd 0
sound db 0x90,0x30,0
file_read:
dd 0
dd 0
dd 1
dd 0
dd 0x3000
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
file_write:
dd 1
dd 0
dd 0
dd 0
dd 0x3000
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
water:
db 247,0,0,0,0,0,255,0
 
db 0,128,0,255,128,0,128,255
 
db 0,255,0,0,255,255,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,7,0,2,1,19,2
 
db 1,2,1,2,17,2,1,18
 
db 35,49,19,2,49,2,17,2
 
db 17,3,6,5,19,2,19,17
 
db 18,35,18,1,2,51,5,1
 
db 2,5,3,6,18,1,19,5
 
db 3,17,2,19,6,5,19,6
 
db 1,3,33,19,6,3,5,3
 
db 2,17,51,2,1,19,18,3
 
db 6,67,18,1,2,3,5,35
 
db 1,2,17,19,5,6,5,6
 
db 3,1,18,51,2,3,18,3
 
db 6,3,5,6,19,5,19,1
 
db 19,33,18,1,18,3,6,3
 
db 6,67,1,2,1,2,65,2
 
db 1,19,5,3,21,3,17,34
 
db 1,66,1,18,67,2,17,2
 
db 33,2,1,18,1,2,1,34
 
db 1,2,1,18,1,18,17,2
 
db 33,34,17,50,17,2,17,66
 
db 1,2,1,19,5,3,2,17
 
db 2,17,50,17,34,19,6,3
 
db 6,19,1,2,65,19,6,3
 
db 17,3,5,19,5,35,18,17
 
db 3,6,3,5,19,18,3,6
 
db 5,19,5,19,18,17,3,21
 
db 3,21,2,1,35,21,19,17
 
db 2,1,2,3,6,3,6,5
 
db 3,1,18,1,35,2,17,50
 
db 1,3,5,6,35,1,2,1
 
db 2,1,2,17,2,17,2,17
 
db 2,51,16
voda1:
db 137,0,0,0,0,255,255,0
 
db 255,128,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,3,0,2,17,18,17
 
db 18,65,18,17,2,33,2,97
 
db 2,1,2,33,18,17,18,49
 
db 18,65,2,65,18,17,2,17
 
db 2,33,18,33,2,113,18,17
 
db 18,17,2,49,18,17,18,145
 
db 34,33,18,49,18,17,18,145
 
db 2,65,2,65,18,17,18,17
 
db 2,17,34,49,18,97,2,113
 
db 2,49,18,1,2,49,2,1
 
db 18,17,2,1,34,65,2,97
 
db 2,113,2,65,18,17,2,49
 
db 18,1,2,33,18,1,2,81
 
db 18,193,18,81,18,17,18,129
 
db 18,145,18,1,2,81,34,17
 
db 18,65,34,1,18,145,2,129
 
db 18,49,18,33,2,33,34,81
 
db 18,97,2,1,16
trava:
db 214,0,0,0,0,0,255,0
 
db 0,128,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,3,0,2,33,2,1
 
db 2,1,2,17,2,1,34,17
 
db 18,1,18,1,2,49,2,17
 
db 2,33,2,1,2,33,2,17
 
db 34,17,18,1,2,1,18,33
 
db 2,17,34,17,18,33,18,17
 
db 50,97,2,33,2,33,18,1
 
db 18,17,50,1,2,1,50,1
 
db 18,65,2,33,18,1,18,17
 
db 18,17,82,33,2,1,2,1
 
db 2,33,2,49,18,1,18,1
 
db 2,1,2,33,2,17,2,1
 
db 2,65,2,1,18,1,2,17
 
db 2,17,34,1,66,1,18,17
 
db 2,17,2,17,2,33,2,1
 
db 18,1,2,1,34,1,2,1
 
db 18,1,18,17,2,33,34,17
 
db 50,17,2,17,66,1,2,17
 
db 2,17,2,17,2,17,50,17
 
db 50,1,34,33,2,81,2,49
 
db 2,33,34,1,18,33,18,1
 
db 66,33,2,1,50,17,2,1
 
db 2,1,2,1,2,49,34,33
 
db 2,1,18,1,18,33,18,1
 
db 2,17,2,17,50,17,2,1
 
db 2,1,2,1,2,1,2,1
 
db 2,17,2,17,2,17,18,17
 
db 2,16
sten3:
db 104,0,0,0,0,128,128,128
 
db 192,192,192,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,3,0,226,66,65,2
 
db 81,2,65,2,81,2,81,2
 
db 65,2,81,2,81,2,65,2
 
db 1,226,66,33,2,81,2,81
 
db 2,65,2,81,2,81,2,65
 
db 2,81,2,81,2,17,226,66
 
db 1,2,81,2,81,2,65,2
 
db 81,2,81,2,65,2,81,2
 
db 81,2,49,226,66,65,2,97
 
db 2,65,2,65,2,97,2,65
 
db 2,65,2,97,2,65,226,82
 
db 33,2,81,2,81,2,65,2
 
db 81,2,81,2,65,2,81,2
 
db 81,2,17,16
sten1:
db 111,0,0,0,0,128,128,128
 
db 192,192,192,0,0,255,255,255
 
db 255,64,128,255,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,6,0,227,67,53,3
 
db 133,3,69,34,5,3,5,98
 
db 5,3,5,98,5,3,5,98
 
db 5,3,5,50,53,3,133,3
 
db 69,227,67,133,3,133,3,114
 
db 5,3,5,98,5,3,114,5
 
db 3,5,98,5,3,133,3,133
 
db 227,83,69,3,133,3,53,50
 
db 5,3,5,98,5,3,5,98
 
db 5,3,5,98,5,3,5,34
 
db 69,3,133,3,53,227,67,101
 
db 3,133,3,21,82,5,3,5
 
db 98,5,3,5,98,5,3,5
 
db 98,5,3,5,2,101,3,133
 
db 3,21,16
pesok:
db 120,0,0,0,0,0,255,255
 
db 0,64,128,0,128,128,64,128
 
db 128,64,128,255,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,6,0,225,81,2,33
 
db 2,65,2,3,33,2,1,5
 
db 49,5,49,2,129,3,225,97
 
db 3,17,2,33,2,1,5,33
 
db 2,1,5,129,5,65,2,65
 
db 2,225,97,2,33,3,17,2
 
db 49,3,145,2,177,3,49,5
 
db 81,5,1,2,33,2,65,3
 
db 17,2,17,3,145,2,209,3
 
db 81,2,49,5,33,2,177,3
 
db 145,2,17,2,5,113,2,225
 
db 1,2,33,3,17,3,49,3
 
db 17,3,161,2,1,5,97,2
 
db 177,2,49,2,33,5,33,2
 
db 193,2,49,3,33,2,81,3
 
db 1,5,1,16
palma:
db 209,0,0,0,0,0,255,0
 
db 0,128,0,0,255,255,64,128
 
db 128,64,128,255,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,6,0,2,33,2,1
 
db 2,1,2,17,2,1,34,17
 
db 18,1,18,1,51,1,2,17
 
db 2,1,35,1,2,33,115,2
 
db 51,21,19,1,2,35,69,35
 
db 53,35,18,3,21,67,5,3
 
db 21,19,1,18,19,2,5,3
 
db 50,1,3,5,3,5,67,17
 
db 3,1,19,17,67,5,99,34
 
db 3,2,35,5,3,5,3,5
 
db 3,5,3,5,35,1,18,1
 
db 2,19,5,35,5,3,5,35
 
db 21,19,33,19,5,35,5,35
 
db 5,51,5,3,34,35,17,51
 
db 20,3,5,35,5,3,2,1
 
db 35,18,3,5,3,36,5,19
 
db 1,35,1,18,3,17,2,3
 
db 2,52,35,50,1,2,17,2
 
db 17,2,1,52,3,34,17,50
 
db 1,34,33,36,49,2,49,2
 
db 33,34,1,36,17,18,1,66
 
db 33,2,1,2,1,36,1,2
 
db 1,2,1,2,1,2,49,66
 
db 36,18,1,18,33,18,1,2
 
db 17,84,2,17,2,1,2,1
 
db 2,1,2,1,2,1,84,2
 
db 17,18,17,2,16
kamni:
db 210,0,0,0,0,0,255,0
 
db 0,128,0,64,128,255,64,128
 
db 128,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,5,0,2,33,2,1
 
db 2,35,1,2,1,34,17,18
 
db 1,18,1,2,17,51,1,2
 
db 33,2,1,2,33,2,1,67
 
db 4,3,2,1,2,1,18,33
 
db 2,17,2,83,4,17,18,17
 
db 50,17,131,2,33,18,1,18
 
db 17,83,20,3,18,1,18,65
 
db 2,67,4,19,4,3,18,17
 
db 82,99,4,35,2,49,18,1
 
db 18,1,2,1,2,17,35,4
 
db 2,1,2,65,2,1,18,1
 
db 2,17,2,17,34,1,66,1
 
db 18,17,2,17,2,17,2,33
 
db 2,1,18,1,2,1,2,19
 
db 1,2,1,18,1,18,19,2
 
db 33,18,35,4,3,18,17,2
 
db 1,67,2,1,2,99,1,2
 
db 17,2,35,4,3,34,35,4
 
db 3,4,3,1,2,17,83,1
 
db 67,20,19,4,3,2,17,51
 
db 4,115,4,35,2,1,83,4
 
db 67,34,33,2,35,1,3,4
 
db 19,1,18,1,2,17,2,17
 
db 50,17,2,1,2,1,2,1
 
db 2,1,2,1,2,17,2,17
 
db 2,17,18,17,2,16
drevo:
db 240,0,0,0,0,0,255,0
 
db 0,128,0,255,0,128,0,64
 
db 128,64,128,128,128,0,128,255
 
db 128,128,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,8,0,2,33,2,1
 
db 2,19,1,35,34,17,18,1
 
db 18,1,2,17,3,38,7,22
 
db 3,1,2,1,2,33,2,1
 
db 19,7,6,23,6,23,3,6
 
db 18,33,2,17,2,3,7,19
 
db 6,3,54,7,19,50,33,3
 
db 22,7,6,3,6,7,22,3
 
db 23,2,1,18,17,22,7,6
 
db 7,3,7,3,7,22,7,6
 
db 35,17,35,54,55,6,23,22
 
db 19,18,19,7,3,7,6,7
 
db 22,7,3,22,3,22,7,3
 
db 18,19,23,3,182,3,33,3
 
db 22,3,7,6,7,6,7,22
 
db 7,6,7,22,3,34,7,22
 
db 7,22,3,39,38,7,6,7
 
db 19,2,1,3,7,6,23,38
 
db 7,38,39,6,7,3,1,2
 
db 19,54,3,38,3,70,3,2
 
db 1,2,1,3,7,6,7,19
 
db 4,5,4,19,6,7,6,3
 
db 1,50,1,34,3,1,36,17
 
db 3,22,2,49,2,33,34,21
 
db 4,33,18,1,66,33,2,1
 
db 52,17,2,1,2,1,2,1
 
db 2,49,18,20,5,4,5,4
 
db 18,1,18,33,18,1,2,1
 
db 132,1,2,1,2,1,2,1
 
db 2,1,36,5,20,5,4,21
 
db 36,17,2,16
baza1:
db 192,0,0,0,0,0,255,0
 
db 0,128,0,255,0,128,255,128
 
db 128,255,0,0,255,128,0,255
 
db 255,0,128,0,255,0,0,255
 
db 0,255,255,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,11,0,2,33,2,1
 
db 2,1,2,17,2,1,34,17
 
db 18,1,18,1,2,49,2,17
 
db 2,33,2,1,2,17,232,9
 
db 4,17,2,8,201,8,3,9
 
db 4,2,1,8,41,150,8,19
 
db 9,2,1,57,6,101,7,6
 
db 8,3,10,3,9,2,8,41
 
db 6,5,84,7,6,8,35,9
 
db 2,8,41,6,5,84,7,6
 
db 8,35,9,2,8,41,6,5
 
db 84,7,6,8,3,21,9,1
 
db 8,41,6,5,84,7,6,8
 
db 3,21,9,2,8,41,6,5
 
db 84,7,6,8,35,9,2,8
 
db 41,6,5,103,6,8,3,10
 
db 3,9,1,8,57,134,8,35
 
db 9,1,8,201,8,3,10,3
 
db 9,2,232,35,9,2,9,131
 
db 10,19,10,3,9,4,3,9
 
db 1,2,25,19,22,131,9,4
 
db 9,33,9,35,22,131,25,1
 
db 18,1,233,9,2,1,2,1
 
db 2,1,2,17,2,17,2,17
 
db 18,17,2,16
spisok:
dd sten1
dd sten3
dd trava
dd kamni
dd palma
dd water
dd voda1
dd baza1
dd drevo
dd pesok
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tanks/trunk/pixengin.inc
0,0 → 1,100
Color db 0
Counter db 0
LastColor db 0
SizeFile dd 0
;LitlCounter db 0
;LitlColor db 0
save_image:
;mov esi,addres_of_file_which_need_compress
;mov edi,addres_where_need_to_save_compressed_file
;mov ecx,size_of_file_which_need_compress
mov dl,byte [esi]
and dl,0xff
mov [LastColor],dl
mov [Counter],byte 1
mov [SizeFile],0
xor edx,edx
inc esi
NextColor:;ç¨â ¥¬ ­®¢ë© 梥⠨§ â ¡«¨æë
mov dl,byte [esi]
and dl,0xf
mov [Color],dl
cmp dl,[LastColor]
jne Different
;㢥«¨ç¨¢ ¥¬ áç¥â稪 ­  1 ¨ ᬮâਬ ¥£® §­ ç¥­¨¥
inc [Counter]
cmp [Counter],16
jl total
;áç¥â稪 à ¢¥­ 16,§­ ç¨â ­ã¦­® á®åà ­¨âì ¯®á«¥¤®¢ â¥«ì­®áâì
dec [Counter]
jmp Different
;’¥¯¥àì ⥪ã騩 梥â áâ « áâ àë¬,¯®í⮬ã á®åà ­¨¬ ¥£® ª ª áâ àë©.
;Ž¡­ã«¨¬ (ᤥ« ¥¬ à ¢­ë¬ 1) áç¥â稪 ¯®¢â®à¥­¨© 梥â (counter)
xor eax,eax
and [Counter],0
mov al,[Color]
mov [LastColor],al
xor eax,eax
jmp total
Different:;¯à®ç¨â ­­ë© 梥⠭¥ ᮢ¯ ¤ ¥â á® áâ àë¬
;§­ ç¨â ­ã¦­® á®åà ­¨âì áâ àë© ¨ ãáâ ­®¢¨âì §­ ç¥­¨ï ¤«ï ­®¢®£®
;
;á®å࠭塞 áâ àë© æ¢¥â
dec [Counter]
call SaveinByte
;add [SizeFile],1
inc edi
;ãáâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨ï ⥪ã饣® æ¢¥â  ª ª áâ à®£®
mov dl,[Color]
mov [LastColor],dl
mov [Counter],1
total:
xor edx,edx
mov dl,[Color]
mov [LastColor],dl
inc esi
dec ecx
cmp ecx,0
jne NextColor
;áç¥â稪 ¬®¦¥â ¡ëâì ­¥¯ãá⮩,¯®í⮬ã çâ®¡ë ­¥ â¥àïâì ¡ ©â®¢
;á®åà ­¨¬ §­ ç¥­¨¥ áç¥â稪  ¨ ¯®¢â®à塞®¥ §­ ç¥­¨¥
call SaveinByte
ret
SaveinByte:xor eax,eax
xor ebx,ebx
mov al,[Counter]
shl al,4
mov bl,[LastColor]
or al,bl
mov [edi],al
inc [SizeFile]
ret
;-----------------------------------------------------------------------
LitlCounter db 0
LitlColor db 0
unpakin:
xor edx,edx
NextLitlColor:xor edx,edx
mov dl,byte[esi]
xor eax,eax
xor ebx,ebx
mov al,dl
mov bl,al
shr al,4
and al,0xf
mov [LitlCounter],al
and bl,0xf
mov [LitlColor],bl
xor eax,eax
xor ebx,ebx
;-------------------------------
mov al,[LitlColor]
beg:mov [edi],al
add edi,1
dec [LitlCounter]
cmp [LitlCounter],-1
jne beg
inc esi
dec ecx
jnz NextLitlColor
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tanks/trunk/tanks.asm
0,0 → 1,2418
;************************************************************
;*GAME TANKS CRETED BY ANDREW_PROGRAMMER AKA ANDREY IGNATYEV*
;*********************/8/2005********************************
use32
org 0x0
include 'lang.inc'
db 'MENUET01'
dd 0x1
dd START
dd I_END
dd 0x4000+640*400*3+50*20*20*3+512+640+1+24*20*20*3+1
dd 0x4000
dd 0x0
dd 0x0
START:
mov eax,40
mov ebx,111b
int 0x40
;----------------------------------------------------------
;---------load all sprites from arrays to memory-----------
;----------------------------------------------------------
and [number_sprite],0
xor eax,eax
nextfile:
mov ebx,[spisok+4*eax]
mov ecx,50
mov esi,ebx
add esi,2
mov edi,0x4000+(640*400*3)+(50*20*20*3)+10
rep movsb ;copy palitra to memory
mov esi,ebx
add esi,52
xor ecx,ecx
mov cl,byte [ebx]
mov edi,0x4000+(640*400*3)+(50*20*20*3)+512
push eax
call unpakin
pop eax
mov ecx,20*20
mov esi,0x4000+(640*400*3)+(50*20*20*3)+512
mov edi,[number_sprite]
imul edi,3*20*20
add edi,0x4000+(640*400*3)
unp:
xor ebx,ebx
mov bl,byte[esi]
lea ebx,[ebx+ebx*2]
add ebx,0x4000+(640*400*3)+(50*20*20*3)+10
mov edx,[ebx]
mov [edi],edx
add esi,1
add edi,3
dec ecx
jnz unp
inc [number_sprite]
inc eax
cmp [number_sprite],26;total number of pictures equal 26
jne nextfile
;----------------------------------------------------------
;------rotate sprites of tanks to pi/2---------------------
;----------------------------------------------------------
mov [sp_pos],0x4000+(640*400*3)+18*20*20*3
and [num_blocks],0
next_block_rotate:
mov [number_sprite],0
next_sprite_rotate:
mov [x],19
and [y],0
rotate_90:
mov ebx,[number_sprite]
mov esi,[y]
imul esi,60
imul ebx,1200
add esi,ebx ;esi=number_sprite*1200+y*60
add esi,dword [sp_pos]
mov edi,0x4000+(640*400*3)+(50*20*20*3)
mov ecx,15
rep movsd
mov edi,[number_sprite]
imul edi,1200
add edi,dword [sp_pos]
add edi,8*20*20*3
mov ebx,[x]
lea ebx,[ebx+2*ebx]
add edi,ebx
mov esi,0x4000+(640*400*3)+(50*20*20*3)
mov ecx,20*3
vertical:
xor eax,eax
mov al,byte[esi+2]
mov [edi+2],al
xor eax,eax
mov ax,word[esi]
mov [edi],ax
add edi,60
add esi,3
sub ecx,3
jnz vertical
dec [x]
inc [y]
cmp [x],-1
jne rotate_90
inc [number_sprite]
cmp [number_sprite],9
jne next_sprite_rotate
add [sp_pos],8*20*20*3
inc [num_blocks]
cmp [num_blocks],3
jne next_block_rotate
;---------------------------------------------------------
restart_level:
call drawwin
;Start game(demo scen)
mov [y],18
@1:
mov [x],30
@2:
mov esi,[x]
mov edi,[y]
imul esi,20*3
imul edi,20*(640*3)
add edi,esi
add edi,0x4000
mov esi,0x4000+(640*400*3)+1200
mov [counter],20
mov eax,esi
mov ebx,edi
@3:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,20*3
add ebx,640*3
dec [counter]
jnz @3
dec [x]
jnz @2
dec [y]
jnz @1
;draw script ******TANKS*******
mov eax,54
@11:
mov esi,5
mov edi,80
xor ebx,ebx
xor edx,edx
mov bl,byte[TANKS_script+2*eax] ;dx
mov dl,byte[TANKS_script+2*eax+1] ;dy
imul ebx,20
imul edx,20
add esi,ebx
add edi,edx
lea esi,[esi+2*esi]
lea edi,[edi+2*edi]
imul edi,640
add edi,esi
add edi,0x4000
mov esi,0x4000+(640*400*3)
mov ebx,esi
mov edx,edi
mov [counter],20
@22:
mov esi,ebx
mov edi,edx
mov ecx,15
rep movsd
add ebx,20*3
add edx,640*3
dec [counter]
jnz @22
dec eax
cmp eax,-1
jne @11
mov eax,7
mov ebx,0x4000
mov ecx,640*65536+400
mov edx,0*65536+20
int 0x40
call menu
;----------------------------
new_level:
call drawwin
mov [SpriteInfo+72+8],dword 100 ;Xo
mov [SpriteInfo+72+36],dword 100 ;Yo
mov edx,[number_level]
call load_level
;--------------------------
and [strike_action],0
and [bazas],0
and [y],0
mov eax,8
next_y:
and [x],0
next_x:
mov esi,[y]
shl esi,5
add esi,[x]
add esi,0x4000+(640*400*3)+(50*20*20*3)+512
xor ebx,ebx
mov bl,byte[esi]
cmp bl,7
jne no_baza
mov ecx,[x]
mov edx,[y]
inc ecx
inc [bazas]
add eax,4
imul ecx,20
imul edx,20
mov [SpriteInfo+9*eax+0],dword 3
mov [SpriteInfo+9*eax+4],dword 1
mov [SpriteInfo+9*eax+8],dword ecx
mov [SpriteInfo+9*eax+12],dword edx
mov [SpriteInfo+9*eax+16],dword 5
mov [SpriteInfo+9*eax+28],dword -5
mov edx,eax
shr edx,2
mov [LifesTanks+edx],byte 3;three lifes
mov [PulyTanks+edx],byte 1 ;can draw animation of "puly"
no_baza:
inc [x]
cmp [x],32
jne next_x
inc [y]
cmp [y],20
jne next_y
mov [LifesPlayer],3*4
and [score],0
;----------------------------------------------------------
;--------------------main loop-----------------------------
;----------------------------------------------------------
maincycle:
;save fon
mov eax,23*4
SaveFonForSprites:
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx ;if ebx<>0 then can save
jz NoSaveFon
mov esi,[SpriteInfo+9*eax+8] ; cordinat x
mov edi,[SpriteInfo+9*eax+12] ; cordinat y
mov edx,eax
shr edx,2
call SaveFon
NoSaveFon:
sub eax,4
cmp eax,-4
jne SaveFonForSprites
;put sprites
mov eax,23*4
PutSprites:
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx
jz NoPutSprite
and ebx,10000b
test ebx,ebx ; move to transparent shablon ?
jnz NoPutSprite
mov esi,[SpriteInfo+9*eax+8] ; x
mov edi,[SpriteInfo+9*eax+12] ; y
mov edx,[SpriteInfo+9*eax+0] ;number sprite in sprites table
shl edx,2
add edx,[SpriteInfo+9*eax+24] ;edx=4*NumSprites+phas
call PutSprite
NoPutSprite:
sub eax,4
cmp eax,-4
jne PutSprites
;put image
call clock
mov ebx,[time]
sub ebx,[time_frame_old]
cmp ebx,5
jl NoPutScreen
mov ebx,[time]
mov [time_frame_old],ebx
mov eax,7
mov ebx,0x4000
mov ecx,640*65536+400
mov edx,0*65536+20
int 0x40
NoPutScreen:
;put fon
mov eax,23*4
PutFonForSprites:
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx
jz NoPutFon
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov edx,eax
shr edx,2
call PutFon
NoPutFon:
sub eax,4
cmp eax,-4
jne PutFonForSprites
;change phas(if need)
mov eax,23*4
ChangePhasSprites:
push eax
call clock
pop eax
mov ebx,[SpriteInfo+9*eax+16] ;time of animation
mov ecx,[SpriteInfo+9*eax+20] ;time of last frame
mov edx,[time]
sub edx,ecx
cmp edx,ebx
jl no_change_phas
mov ebx,[time]
mov [SpriteInfo+9*eax+20],ebx ;save new time
;------------------------------
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov ecx,[SpriteInfo+9*eax+28]
mov edx,[SpriteInfo+9*eax+32]
add esi,ecx ;x=x+dx
add edi,edx ;y=y+dy
mov [SpriteInfo+9*eax+8],dword esi
mov [SpriteInfo+9*eax+12],dword edi
;-------------------------------
mov edx,[SpriteInfo+9*eax+24] ;phas
add edx,1
cmp edx,4
jne no_limit_phas
xor edx,edx
mov [SpriteInfo+9*eax+24],dword edx
mov [SpriteInfo+9*eax+4],dword edx
jmp no_change_phas
no_limit_phas:
mov [SpriteInfo+9*eax+24],dword edx
no_change_phas:
sub eax,4
cmp eax,-4
jne ChangePhasSprites
;-------------------------------------------------
;----------------keys-----------------------------
;-------------------------------------------------
mov eax,23
mov ebx,3
int 0x40
cmp eax,1
jne keypressed
call drawwin
jmp action
keypressed:
cmp eax,2
jne action
and [_dx],0
and [_dy],0
mov eax,2
int 0x40
shr eax,8
;---------
cmp eax,32
jne key2
cmp [strike_action],0
jne action
mov [SpriteInfo+36+4],dword 1 ;can draw sprite "puly"
mov [strike_action],1 ;sprite is active
mov eax,[SpriteInfo+72+8]
mov ebx,[SpriteInfo+72+12]
mov ecx,[SpriteInfo+72+28]
mov edx,[SpriteInfo+72+32]
add eax,ecx
add ebx,edx
mov [SpriteInfo+36+8],dword eax
mov [SpriteInfo+36+12],dword ebx
jmp action
key2:cmp eax,176
jne key3
mov [SpriteInfo+8*9+0],dword 8
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword -5
mov [SpriteInfo+8*9+32],dword 0
mov [_dx],0
mov [_dy],10
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword -5
mov [SpriteInfo+36+32],dword 0
jmp action
key3:cmp eax,179
jne key4
mov [SpriteInfo+8*9+0],dword 4
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword 5
mov [SpriteInfo+8*9+32],dword 0
mov [_dx],15
mov [_dy],10
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword 5
mov [SpriteInfo+36+32],dword 0
jmp action
key4:cmp eax,178
jne key5
mov [SpriteInfo+8*9+0],dword 2
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword 0
mov [SpriteInfo+8*9+32],dword -5
mov [_dx],10
mov [_dy],1
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword 0
mov [SpriteInfo+36+32],dword -5
jmp action
key5:cmp eax,177
jne key6
mov [SpriteInfo+8*9+0],dword 6
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword 0
mov [SpriteInfo+8*9+32],dword 5
mov [_dy],15
mov [_dx],10
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword 0
mov [SpriteInfo+36+32],dword 5
jmp action
key6:cmp eax,27
jne action
mov eax,-1
int 0x40
action:
mov [SpriteInfo+72+4],dword 1
mov [SpriteInfo+72+16],dword 5 ;usal speed of tank
mov esi,[SpriteInfo+8*9+8] ;cordinat x of sprite
mov edi,[SpriteInfo+8*9+12] ;cordinat y of sprite
mov ecx,[SpriteInfo+72+28]
mov edx,[SpriteInfo+72+32]
add ecx,[_dx]
add edx,[_dy]
add esi,ecx ;x=x+_dx+dx
add edi,edx ;y=y+_dy+dy
call map_x_y
cmp ecx,6
jne no_woter
mov [SpriteInfo+72+16],dword 7 ;in water tank slow move
no_woter:
cmp ecx,4
jne no_palma
mov [SpriteInfo+72+4],dword 10000b;if bit 4 than transparent sprite
no_palma:
cmp ecx,8
jne no_derevo
mov [SpriteInfo+72+4],dword 10000b
no_derevo:
test edx,edx
jnz ani
mov [SpriteInfo+8*9+28],dword 0
mov [SpriteInfo+8*9+32],dword 0
;-------------------------------------------------
ani:
mov eax,[strike_action]
test eax,eax
jz no_anim_strike
mov esi,[SpriteInfo+36+8]
mov edi,[SpriteInfo+36+12]
mov ecx,[SpriteInfo+36+28]
mov edx,[SpriteInfo+36+32]
add esi,ecx
add edi,edx
call map_x_y
cmp cl,0
jne no_stena
mov [ebx],byte 2 ;trava
jmp bum
no_stena:
cmp cl,1
jne no_brony
jmp bum
no_brony:
cmp cl,7
jne anim_action_puly
sub [bazas],1
mov [ebx],byte 2 ;trava
bum:
mov esi,[SpriteInfo+36+8]
mov edi,[SpriteInfo+36+12]
mov [SpriteInfo+4],dword 1
mov [SpriteInfo+8],dword esi
mov [SpriteInfo+12],dword edi
mov [SpriteInfo+36+4],dword 0
mov [end_bum],1
jmp no_anim_strike
anim_action_puly:
mov [SpriteInfo+36+4],dword 1
no_anim_strike:
;-------------------------------------------------
;¯à®¢¥à塞 ¯®¯ «  «¨ ¯ã«ï ¢ ¯à®â¨¢­¨ª®¢
mov esi,[SpriteInfo+4*9+8]
mov edi,[SpriteInfo+4*9+12]
mov [x],esi ;ª®®à¤¨­ â  x ¯ã«¨
mov [y],edi ;ª®®à¤¨­ â  y ¯ã«¨
mov eax,3*4
bum_tank:
mov ebx,eax
shr ebx,2
xor ecx,ecx
mov cl,byte [LifesTanks+ebx]
cmp ecx,0
jz no_strike
mov esi,[SpriteInfo+9*eax+8] ;x
mov edi,[SpriteInfo+9*eax+12] ;y
sub esi,[x]
sub edi,[y]
cmp esi,5
ja no_strike
cmp edi,5
ja no_strike
add [score],5
cmp [score],20
jl no_bonus
add [LifesPlayer],4
and [score],0
no_bonus:
dec ecx;,1
mov [LifesTanks+ebx],cl ;life=life-1
mov esi,[x]
mov edi,[y]
mov [SpriteInfo+4],dword 1
mov [SpriteInfo+8],dword esi
mov [SpriteInfo+12],dword edi
mov [SpriteInfo+36+4],dword 0
mov [end_bum],1
no_strike:
add eax,4
cmp eax,10*4
jne bum_tank
;-------------------------------------------------
xor eax,eax
mov al,[end_bum]
test eax,eax
jz no_end_strike
mov eax,[SpriteInfo+24]
cmp eax,3
jne no_end_strike
and [strike_action],0
and [end_bum],0
mov edx,[number_level]
mov ecx,15
call load_level
no_end_strike:
;----------------------------
;¯à®¢¥à塞,¯®¯ «¨ «¨ ¯à®â¨¢­¨ª¨ ¢ ¨£à®ª 
mov eax,3*4
mov esi,[SpriteInfo+72+8]
mov edi,[SpriteInfo+72+12]
mov [x],esi
mov [y],edi
strike_to_player:
mov ebx,eax
add ebx,28
mov esi,[SpriteInfo+9*ebx+8]
mov edi,[SpriteInfo+9*ebx+12]
sub esi,[x]
sub edi,[y]
cmp esi,5
ja no_strike_to_player
cmp edi,5
ja no_strike_to_player
mov esi,[x]
mov edi,[y]
mov [SpriteInfo+9*ebx+4],dword 0
add ebx,28
mov [SpriteInfo+9*ebx+4],dword 1
mov [SpriteInfo+9*ebx+8],dword esi
mov [SpriteInfo+9*ebx+12],dword edi
sub [LifesPlayer],1
cmp [LifesPlayer],0
jne no_game_over
call end_game
jmp restart_level
no_game_over:
no_strike_to_player:
add eax,4
cmp eax,10*4
jne strike_to_player
;----------------------------
xor eax,eax
mov al,[bazas]
test eax,eax
jnz no_end_level
call you_won
inc [number_level]
cmp [number_level],25
jne no_end_game
mov eax,-1
int 0x40
no_end_game:
jmp new_level
no_end_level:
;-------------------------------------------------
;------------ logic of tanks----------------------
;-------------------------------------------------
mov eax,12
next_bad_tank:
mov ebx,eax
shr ebx,2
xor ecx,ecx
mov cl,byte[LifesTanks+ebx]
test ecx,ecx
jz no_action_bad_tank
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx
jnz no_action_bad_tank
;---------------------
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov [x],esi
mov [y],edi
mov ecx,[SpriteInfo+9*eax+28]
mov edx,[SpriteInfo+9*eax+32]
;ᬮâਬ çâ® ¢¯¥à¥¤¨ â ­ª -¯à®â¨¢­¨ª 
cmp ecx,0
ja more_null_x
lea ecx,[ecx+2*ecx]
jmp test_y
more_null_x:
shl ecx,2
add ecx,15
test_y:
cmp edx,0
ja more_null_y
lea edx,[edx+2*edx]
jmp add_numbers
more_null_y:
shl edx,2
add edx,15
add_numbers:
;--------------------
add esi,ecx
add edi,edx
call map_x_y
cmp ecx,4
jne no_palma_p
mov [SpriteInfo+9*eax+4],dword 10000b
no_palma_p:
cmp ecx,8
jne no_derevo_p
mov [SpriteInfo+9*eax+4],dword 10000b
no_derevo_p:
;¥á«¨ ­  ¯ã⨠⠭ª  ¯à¥¯ïâá⢨¥,â® ­ ¤® ¨§¬¥­¨âì
;­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï
test edx,edx
jnz lab1
;¯à®¢¥à塞 - ­¥ ¯®¯ « «¨ â ­ª ¢ â㯨ª(3 ­ ¯à¢«¥­¨ï § ­ïâë)
and [tupik],0
mov esi,[x]
mov edi,[y]
add esi,(20+15)
add edi,10
call map_x_y
test edx,edx
jnz direct1
inc [tupik]
direct1:
mov esi,[x]
mov edi,[y]
add esi,10
add edi,(20+15)
call map_x_y
test edx,edx
jnz direct2
inc [tupik]
direct2:
mov esi,[x]
mov edi,[y]
add esi,-15
add edi,10
call map_x_y
test edx,edx
jnz direct3
inc [tupik]
direct3:
mov esi,[x]
mov edi,[y]
add esi,10
add edi,-15
call map_x_y
test edx,edx
jnz direct4
inc [tupik]
direct4:
cmp [tupik],3
je no_move0
;------------------
;strategy1
mov esi,[x]
mov edi,[y]
add esi,(20+15)
add edi,10
call map_x_y
test edx,edx
jnz no_strategy1
mov esi,[x]
mov edi,[y]
add esi,10
add edi,-15
call map_x_y
jnz no_strategy1
jmp no_move3 ;going to left
no_strategy1:
;------------------
mov esi,[x]
mov edi,[y]
add esi,-15
add edi,10
call map_x_y
test edx,edx
jnz no_strategy2
mov esi,[x]
mov edi,[y]
add esi,10
add edi,-15
call map_x_y
test edx,edx
jnz no_strategy2
jmp no_move2
no_strategy2:
;------------------
mov esi,[x]
mov edi,[y]
add edi,(20+15)
add esi,10
call map_x_y
test edx,edx
jnz no_strategy3
mov esi,[x]
mov edi,[y]
add esi,-15
add edi,10
call map_x_y
test edx,edx
jnz no_strategy3
jmp no_move1
no_strategy3:
;-------------------------------------------------
no_move0:
mov esi,[x] ; x
mov edi,[y] ; y
add edi,-15 ; (y-20) up
add esi,10
call map_x_y
test edx,edx
jz no_move1
;¢¢¥àåã ᢮¡®¤­® - ¬®¦­® ¤¢¨£ âìáï up
mov [SpriteInfo+9*eax+0],dword 3
mov [SpriteInfo+9*eax+28],dword 0
mov [SpriteInfo+9*eax+32],dword -5
jmp lab1
no_move1:
mov esi,[x]
mov edi,[y]
add esi,(20+15) ;x+20
add edi,10
call map_x_y
test edx,edx
jz no_move2
; right
mov [SpriteInfo+9*eax+0],dword 5
mov [SpriteInfo+9*eax+28],dword 5
mov [SpriteInfo+9*eax+32],dword 0
jmp lab1
no_move2:
mov esi,[x]
mov edi,[y]
add esi,10 ;x-20
add edi,(20+15)
call map_x_y
test edx,edx
jz no_move3
; down
mov [SpriteInfo+9*eax+0],dword 7
mov [SpriteInfo+9*eax+28],dword 0
mov [SpriteInfo+9*eax+32],dword 5
jmp lab1
no_move3:
mov esi,[x]
mov edi,[y]
add edi,10 ;y+20
add esi,-15
call map_x_y
test edx,edx
jz no_move4
;¢­¨§ã ᢮¡®¤­®-¬®¦­® ¤¢¨£ âìáï left
mov [SpriteInfo+9*eax+0],dword 9
mov [SpriteInfo+9*eax+28],dword -5
mov [SpriteInfo+9*eax+32],dword 0
jmp lab1
no_move4:
mov [SpriteInfo+9*eax+28],dword 0
mov [SpriteInfo+9*eax+32],dword 0
lab1:
mov edx,dword[SpriteInfo+9*eax+4]
test edx,edx
jnz no_action_bad_tank
mov [SpriteInfo+9*eax+4],dword 1
no_action_bad_tank:
add eax,4
cmp eax,10*4
jne next_bad_tank
;-------------------------------------------------
mov eax,12
next_puly:
mov edx,eax
shr edx,2
xor ecx,ecx
mov cl,byte[PulyTanks+edx]
test ecx,ecx ;can change course of puly ?
jz no_change_course
xor ecx,ecx
mov cl,byte[LifesTanks+edx]
test ecx,ecx ;is tank not destroed ?
jz no_draw_s
mov ecx,[SpriteInfo+9*eax+24] ;tank's phas of animation
test ecx,ecx ; phas=0 ?
jnz no_change_course
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov ecx,[SpriteInfo+9*eax+28]
mov edx,[SpriteInfo+9*eax+32]
mov ebx,eax
add ebx,28
mov [SpriteInfo+9*ebx+0],dword 1
mov [SpriteInfo+9*ebx+4],dword 1
mov [SpriteInfo+9*ebx+28],dword ecx
mov [SpriteInfo+9*ebx+32],dword edx
mov [SpriteInfo+9*ebx+16],dword 3
mov [SpriteInfo+9*ebx+8],dword esi
mov [SpriteInfo+9*ebx+12],dword edi
mov ebx,eax
shr ebx,2
mov [PulyTanks+ebx],byte 0
jmp no_draw_s
;-------------------
no_change_course:
mov ebx,eax
add ebx,28
mov ecx,[SpriteInfo+9*ebx+24]
test ecx,ecx
jnz no_draw_s
mov esi,[SpriteInfo+9*ebx+8]
mov edi,[SpriteInfo+9*ebx+12]
mov ecx,[SpriteInfo+9*ebx+28]
mov edx,[SpriteInfo+9*ebx+32]
call map_x_y
cmp ecx,1
je bumm
cmp ecx,0
je strike_to_wall
jmp no_bumm
strike_to_wall:
mov [ebx],byte 2
bumm:
;-------------------
mov ebx,eax
add ebx,28
mov [SpriteInfo+9*ebx+28],dword 0
mov [SpriteInfo+9*ebx+32],dword 0
mov esi,[SpriteInfo+9*ebx+8]
mov edi,[SpriteInfo+9*ebx+12]
add ebx,28
mov [SpriteInfo+9*ebx+4],dword 1
mov [SpriteInfo+9*ebx+8],dword esi
mov [SpriteInfo+9*ebx+12],dword edi
mov [SpriteInfo+9*ebx+16],dword 3
mov [SpriteInfo+9*ebx+28],dword 0
mov [SpriteInfo+9*ebx+32],dword 0
mov ebx,eax
shr ebx,2
mov [PulyTanks+ebx],byte 1
mov edx,[number_level]
mov ecx,15
push eax
call load_level
pop eax
jnp no_draw_s
;-------------------
no_bumm:
mov ebx,eax
add ebx,28
mov [SpriteInfo+9*ebx+4],dword 1 ; can draw sprite of puly
no_draw_s:
add eax,4
cmp eax,10*4
jne next_puly
;-------------------------------------------------
;-------------end of tanks logic------------------
;-------------------------------------------------
mov eax,13
mov ebx,180*65536+220
mov ecx,425*65536+17
mov edx,0xdfffff
int 0x40
mov eax,4
mov ebx,190*65536+430
mov ecx,0x1ded00;0
mov edx,Level
mov esi,5
int 0x40
mov eax,4
mov ebx,260*65536+430
mov ecx,0x3558ff
mov edx,Lifes
mov esi,5
int 0x40
mov eax,4
mov ebx,330*65536+430
mov ecx,0xf93500
mov edx,Score
mov esi,5
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[number_level]
inc ecx
mov edx,225*65536+430
mov esi,0x1ded00
int 0x40
mov eax,47
mov ebx,3*65536
xor ecx,ecx
mov cl,[LifesPlayer]
shr ecx,2
mov edx,295*65536+430
mov esi,0x3558ff
int 0x40
mov eax,47
mov ebx,3*65536
xor ecx,ecx
mov cl,byte[score]
mov edx,365*65536+430
mov esi,0xf93500
int 0x40
jmp maincycle
;----------------------------------------------------------
;-----------------end of main cycle------------------------
;----------------------------------------------------------
;draw sprite in video memory
PutSprite:
push eax
mov ebx,esi
mov eax,edi
lea ebx,[ebx+2*ebx]
lea eax,[eax+2*eax]
imul eax,640
add eax,0x4000
add eax,ebx
mov [counter],20
mov esi,edx
imul esi,1200
add esi,0x4000+(640*400*3)+10*1200
mov ebx,esi
mov edi,eax
draw:
mov esi,ebx
mov edi,eax
mov ecx,20
;--------------------
rep_movsb:
xor edx,edx
mov edx,[esi]
and edx,0xffffff
test edx,edx ;0 is transparent color
jz transparent_color
mov [edi],dx
shr edx,16
mov [edi+2],dl
transparent_color:
add esi,3
add edi,3
sub ecx,1
jnz rep_movsb
;--------------------
add eax,640*3
add ebx,20*3
dec [counter]
jnz draw
pop eax
ret
;----------------------------------------------------------
SaveFon:
push eax
lea esi,[esi+2*esi]
lea edi,[edi+2*edi]
imul edi,640
add esi,edi
add esi,0x4000
mov edi,edx
imul edi,1200
add edi,0x4000+(640*400*3)+(50*20*20*3)+512+641
mov [counter],20
mov eax,esi
mov ebx,edi
save_to:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,640*3
add ebx,20*3
dec [counter]
jnz save_to
pop eax
ret
;----------------------------------------------------------
PutFon:
push eax
lea esi,[esi+2*esi]
lea edi,[edi+2*edi]
imul edi,640
add edi,esi
add edi,0x4000
mov esi,edx
imul esi,1200
add esi,0x4000+(640*400*3)+(50*20*20*3)+512+641
mov [counter],20
mov eax,esi
mov ebx,edi
put_to:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,20*3
add ebx,640*3
dec [counter]
jnz put_to
pop eax
ret
;----------------------------------------------------------
;get time in 1/100 sec
clock: mov eax,26
mov ebx,9
int 0x40
mov [time],eax
ret
;----------------------------------------------------------
;-----------------load level to memory---------------------
;----------------------------------------------------------
load_level:
cmp ecx,15
je no_load_level
mov eax,edx
mov ebx,[levels+4*eax]
mov esi,ebx
add esi,2
xor ecx,ecx
xor eax,eax
mov cl,byte[ebx]
mov al,byte[ebx+1]
add ecx,eax
mov edi,0x4000+(640*400*3)+(50*20*20*3)+512
call unpakin
no_load_level:
and [y],0
c_y:
and [x],0
c_x:
mov eax,[x]
mov ebx,[y]
shl ebx,5
add eax,ebx
add eax,0x4000+(640*400*3)+(50*20*20*3)+512
mov ecx,eax
xor eax,eax
mov al,byte [ecx]
imul eax,1200
add eax,0x4000+(640*400*3)
mov ebx,[x]
imul ebx,20*3
mov ecx,[y]
imul ecx,20*3*640
add ebx,ecx
add ebx,0x4000
mov esi,eax
mov edi,ebx
;----------------------------
mov edx,20
next_line:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,20*3
add ebx,(640*3)
dec edx
jnz next_line
;----------------------------
inc [x]
cmp [x],32
jne c_x
inc [y]
cmp [y],20
jne c_y
ret
;----------------------------------------------------------
map_x_y:
push eax
mov ecx,20
mov eax,esi
cdq
idiv ecx
mov esi,eax
mov eax,edi
cdq
idiv ecx
mov edi,eax
;------------------
mov ebx,edi
shl ebx,5
add ebx,esi
add ebx,0x4000+(640*400*3)+(50*20*20*3)+512
xor ecx,ecx
mov cl,byte[ebx]
cmp cl,0
je false_draw
cmp cl,1
je false_draw
cmp cl,3
je false_draw
cmp cl,7
je false_draw
mov edx,1
jmp lab2
false_draw:
xor edx,edx
lab2:
pop eax
ret
;----------------------------------------------------------
you_won:
mov eax,13
mov ebx,1*65536+640
mov ecx,20*65536+400
mov edx,0xc6e9
int 0x40
mov eax,4
mov ebx,220*65536+190
mov ecx,0xffffff
mov edx,won1
mov esi,29
int 0x40
mov eax,4
mov ebx,220*65536+200
mov ecx,0xffffff
mov edx,won2
mov esi,29
int 0x40
mov eax,4
mov ebx,220*65536+210
mov ecx,0xffffff
mov edx,won3
mov esi,29
int 0x40
mov eax,5
mov ebx,100
int 0x40
ret
;----------------------------------------------------------
end_game:
mov eax,13
mov ebx,0*65536+640
mov ecx,20*65536+400
mov edx,0
int 0x40
mov eax,4
mov ebx,280*65536+200
mov ecx,0xffffff
mov edx,game_over
mov esi,9
int 0x40
mov eax,5
mov ebx,150
int 0x40
ret
;----------------------------------------------------------
drawwin:
mov eax,12
mov ebx,1
int 0x40
;à¨á㥬 ®ª­® § ¤ ¢ ï ¢á¥ ­¥®¡å®¤¨¬ë¥ 梥â 
mov eax,0
mov ebx,50*65536+640
mov ecx,50*65536+480
mov edx,0x03AABBCC
mov esi,0x805080d0
mov edi,0x005080d0
int 0x40
;¯¨è¥¬ § £®«®¢®ª ®ª­ 
mov eax,4
mov ebx,5*65536+5
mov ecx,0x10ffffff
mov edx,name
mov esi,42
int 0x40
ret
;----------------------------------------------------------
menu:
cycle_menu:
mov eax,13
mov ebx,235*65536+140
mov ecx,230*65536+20
mov edx,0xed16
int 0x40
mov eax,4
mov ebx,255*65536+235
mov ecx,0xff0200
mov edx,start_menu
mov esi,11
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[number_level]
mov edx,345*65536+235
mov esi,0xff0200
int 0x40
still:
mov eax,10
int 0x40
cmp eax,2
jne still
mov eax,2
int 0x40
shr eax,8
cmp eax,32
je start_game
cmp eax,176
jne no_left
dec [number_level]
and [number_level],11111b
jmp cycle_menu
no_left:
cmp eax,179
jne no_right
inc [number_level]
and [number_level],11111b
jmp cycle_menu
no_right:
cmp eax,27
jne cycle_menu
mov eax,-1
int 0x40
start_game:
ret
;----------------------------------------------------------
;--------------unpak pix engin-----------------------------
;----------------------------------------------------------
unpakin:
NextLitlColor:
xor edx,edx
mov dl,byte[esi]
xor eax,eax
xor ebx,ebx
mov al,dl
mov bl,al
shr al,4
and al,0xf
mov [LitlCounter],al
and bl,0xf
mov [LitlColor],bl
xor eax,eax
;----------------------
mov al,[LitlColor]
beg:mov [edi],al
add edi,1
add [LitlCounter],-1
cmp [LitlCounter],-1
jne beg
inc esi
dec ecx
jnz NextLitlColor
ret
LitlCounter db 0
LitlColor db 0
;----------------------------------------------------------
time dd 0
time_frame_old dd 0
number_sprite dd 0
number_level dd 0
counter db 0
sp_pos dd 0
num_blocks dd 0
;-------------------
x dd 0
y dd 0
_dx dd 0
_dy dd 0
strike_action dd 0
end_bum db 0
bazas db 0
name db ' game *TANKS* creted by andrew_programmer'
won1 db '*****************************'
won2 db '* YOU WON LEVEL !!! *'
won3 db '*****************************'
game_over db 'GAME OVER'
Lifes db 'LIFES'
Level db 'LEVEL'
Score db 'SCORE'
start_menu db 'START LEVEL'
LifesTanks rb 16
PulyTanks rb 16
LifesPlayer db 0
tupik db 0
score db 0
SpriteInfo:
dd 0,0,0,0,4,0,0,0,0
dd 1,0,100,80,3,0,0,0,0
dd 2,1,100,100,5,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
TANKS_script:
db 1,1,2,1,3,1,4,1,5,1,3,2,3,3,3,4,3,5 ;T
db 7,3,7,4,7,5,8,2,8,4,9,1,9,4,10,2,10,4,11,3,11,4,11,5 ;A
db 13,1,13,2,13,3,13,4,13,5,14,1,15,2,16,3,17,1,17,2,17,3,17,4,17,5 ;N
db 19,1,19,2,19,3,19,4,19,5,20,3,21,2,22,1,22,3,23,4,23,5 ;K
db 25,4,26,2,26,5,27,1,27,3,27,5,27,1,28,4,28,1,29,2 ;S
 
;----------------------------------------------------------
;-----------------------data-------------------------------
;----------------------------------------------------------
water:
db 247,0,0,0,0,0,255,0
db 0,128,0,255,128,0,128,255
db 0,255,0,0,255,255,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,7,0,2,1,19,2
db 1,2,1,2,17,2,1,18
db 35,49,19,2,49,2,17,2
db 17,3,6,5,19,2,19,17
db 18,35,18,1,2,51,5,1
db 2,5,3,6,18,1,19,5
db 3,17,2,19,6,5,19,6
db 1,3,33,19,6,3,5,3
db 2,17,51,2,1,19,18,3
db 6,67,18,1,2,3,5,35
db 1,2,17,19,5,6,5,6
db 3,1,18,51,2,3,18,3
db 6,3,5,6,19,5,19,1
db 19,33,18,1,18,3,6,3
db 6,67,1,2,1,2,65,2
db 1,19,5,3,21,3,17,34
db 1,66,1,18,67,2,17,2
db 33,2,1,18,1,2,1,34
db 1,2,1,18,1,18,17,2
db 33,34,17,50,17,2,17,66
db 1,2,1,19,5,3,2,17
db 2,17,50,17,34,19,6,3
db 6,19,1,2,65,19,6,3
db 17,3,5,19,5,35,18,17
db 3,6,3,5,19,18,3,6
db 5,19,5,19,18,17,3,21
db 3,21,2,1,35,21,19,17
db 2,1,2,3,6,3,6,5
db 3,1,18,1,35,2,17,50
db 1,3,5,6,35,1,2,1
db 2,1,2,17,2,17,2,17
db 2,51,16
voda1:
db 137,0,0,0,0,255,255,0
db 255,128,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,3,0,2,17,18,17
db 18,65,18,17,2,33,2,97
db 2,1,2,33,18,17,18,49
db 18,65,2,65,18,17,2,17
db 2,33,18,33,2,113,18,17
db 18,17,2,49,18,17,18,145
db 34,33,18,49,18,17,18,145
db 2,65,2,65,18,17,18,17
db 2,17,34,49,18,97,2,113
db 2,49,18,1,2,49,2,1
db 18,17,2,1,34,65,2,97
db 2,113,2,65,18,17,2,49
db 18,1,2,33,18,1,2,81
db 18,193,18,81,18,17,18,129
db 18,145,18,1,2,81,34,17
db 18,65,34,1,18,145,2,129
db 18,49,18,33,2,33,34,81
db 18,97,2,1,16
trava:
db 214,0,0,0,0,0,255,0
db 0,128,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,3,0,2,33,2,1
db 2,1,2,17,2,1,34,17
db 18,1,18,1,2,49,2,17
db 2,33,2,1,2,33,2,17
db 34,17,18,1,2,1,18,33
db 2,17,34,17,18,33,18,17
db 50,97,2,33,2,33,18,1
db 18,17,50,1,2,1,50,1
db 18,65,2,33,18,1,18,17
db 18,17,82,33,2,1,2,1
db 2,33,2,49,18,1,18,1
db 2,1,2,33,2,17,2,1
db 2,65,2,1,18,1,2,17
db 2,17,34,1,66,1,18,17
db 2,17,2,17,2,33,2,1
db 18,1,2,1,34,1,2,1
db 18,1,18,17,2,33,34,17
db 50,17,2,17,66,1,2,17
db 2,17,2,17,2,17,50,17
db 50,1,34,33,2,81,2,49
db 2,33,34,1,18,33,18,1
db 66,33,2,1,50,17,2,1
db 2,1,2,1,2,49,34,33
db 2,1,18,1,18,33,18,1
db 2,17,2,17,50,17,2,1
db 2,1,2,1,2,1,2,1
db 2,17,2,17,2,17,18,17
db 2,16
tan22:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 255,255,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,8,0,112,51,8,224
db 0,19,144,8,96,19,144,8
db 64,8,0,19,144,8,32,8
db 0,8,0,19,32,8,32,24
db 2,20,18,8,39,19,39,8
db 18,20,82,55,19,55,82,20
db 18,7,6,23,19,23,6,7
db 18,20,82,6,23,51,23,6
db 146,23,83,23,82,20,18,23
db 19,22,19,23,18,20,82,23
db 19,22,19,23,82,20,18,23
db 83,23,18,20,82,23,83,23
db 146,39,51,39,82,20,18,151
db 18,20,66,8,151,8,50,8
db 48,21,87,21,8,224,224,240
tan21:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 255,255,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,8,0,112,51,8,224
db 0,19,144,8,96,19,144,8
db 64,8,0,19,144,8,32,8
db 0,8,0,19,32,8,32,24
db 66,8,39,19,39,8,82,20
db 18,55,19,55,18,20,82,7
db 6,23,19,23,6,7,82,20
db 18,6,23,51,23,6,18,20
db 82,23,83,23,146,23,19,22
db 19,23,82,20,18,23,19,22
db 19,23,18,20,82,23,83,23
db 82,20,18,23,83,23,18,20
db 82,39,51,39,146,151,82,20
db 2,8,151,8,2,20,2,8
db 48,21,87,21,8,224,224,240
tan12:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,7,0,112,51,7,224
db 0,19,144,7,96,19,144,7
db 64,7,0,19,144,7,32,7
db 0,7,0,19,32,7,0,55
db 2,20,18,7,33,19,33,7
db 18,20,82,49,19,49,82,20
db 18,1,6,17,19,17,6,1
db 18,20,82,6,17,51,17,6
db 146,17,83,17,82,20,18,17
db 19,22,19,17,18,20,82,17
db 19,22,19,17,82,20,18,17
db 83,17,18,20,82,17,83,17
db 146,33,51,33,82,20,18,145
db 18,20,66,7,145,7,50,7
db 48,21,81,21,7,224,224,240
tan11:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,7,0,112,51,7,224
db 0,19,144,7,96,19,144,7
db 64,7,0,19,144,7,32,7
db 0,7,0,19,32,7,32,23
db 66,7,33,19,33,7,82,20
db 18,49,19,49,18,20,82,1
db 6,17,19,17,6,1,82,20
db 18,6,17,51,17,6,18,20
db 82,17,83,17,146,17,19,22
db 19,17,82,20,18,17,19,22
db 19,17,18,20,82,17,83,17
db 82,20,18,17,83,17,18,20
db 82,33,51,33,146,145,82,20
db 2,7,145,7,2,20,2,7
db 48,21,81,21,7,224,224,240
sten3:
db 104,0,0,0,0,128,128,128
db 192,192,192,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,3,0,226,66,65,2
db 81,2,65,2,81,2,81,2
db 65,2,81,2,81,2,65,2
db 1,226,66,33,2,81,2,81
db 2,65,2,81,2,81,2,65
db 2,81,2,81,2,17,226,66
db 1,2,81,2,81,2,65,2
db 81,2,81,2,65,2,81,2
db 81,2,49,226,66,65,2,97
db 2,65,2,65,2,97,2,65
db 2,65,2,97,2,65,226,82
db 33,2,81,2,81,2,65,2
db 81,2,81,2,65,2,81,2
db 81,2,17,16
sten1:
db 111,0,0,0,0,128,128,128
db 192,192,192,0,0,255,255,255
db 255,64,128,255,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,6,0,227,67,53,3
db 133,3,69,34,5,3,5,98
db 5,3,5,98,5,3,5,98
db 5,3,5,50,53,3,133,3
db 69,227,67,133,3,133,3,114
db 5,3,5,98,5,3,114,5
db 3,5,98,5,3,133,3,133
db 227,83,69,3,133,3,53,50
db 5,3,5,98,5,3,5,98
db 5,3,5,98,5,3,5,34
db 69,3,133,3,53,227,67,101
db 3,133,3,21,82,5,3,5
db 98,5,3,5,98,5,3,5
db 98,5,3,5,2,101,3,133
db 3,21,16
puly1:
db 48,0,0,0,0,0,255,255
db 128,0,255,0,0,255,64,128
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,224,224,224,224
db 224,224,224,224,96,49,224,17
db 20,17,192,17,4,18,4,17
db 176,1,4,50,4,1,176,17
db 4,18,4,17,192,17,20,17
db 224,49,224,224,224,224,224,224
db 224,224,224,240
pesok:
db 120,0,0,0,0,0,255,255
db 0,64,128,0,128,128,64,128
db 128,64,128,255,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,6,0,225,81,2,33
db 2,65,2,3,33,2,1,5
db 49,5,49,2,129,3,225,97
db 3,17,2,33,2,1,5,33
db 2,1,5,129,5,65,2,65
db 2,225,97,2,33,3,17,2
db 49,3,145,2,177,3,49,5
db 81,5,1,2,33,2,65,3
db 17,2,17,3,145,2,209,3
db 81,2,49,5,33,2,177,3
db 145,2,17,2,5,113,2,225
db 1,2,33,3,17,3,49,3
db 17,3,161,2,1,5,97,2
db 177,2,49,2,33,5,33,2
db 193,2,49,3,33,2,81,3
db 1,5,1,16
palma:
db 209,0,0,0,0,0,255,0
db 0,128,0,0,255,255,64,128
db 128,64,128,255,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,6,0,2,33,2,1
db 2,1,2,17,2,1,34,17
db 18,1,18,1,51,1,2,17
db 2,1,35,1,2,33,115,2
db 51,21,19,1,2,35,69,35
db 53,35,18,3,21,67,5,3
db 21,19,1,18,19,2,5,3
db 50,1,3,5,3,5,67,17
db 3,1,19,17,67,5,99,34
db 3,2,35,5,3,5,3,5
db 3,5,3,5,35,1,18,1
db 2,19,5,35,5,3,5,35
db 21,19,33,19,5,35,5,35
db 5,51,5,3,34,35,17,51
db 20,3,5,35,5,3,2,1
db 35,18,3,5,3,36,5,19
db 1,35,1,18,3,17,2,3
db 2,52,35,50,1,2,17,2
db 17,2,1,52,3,34,17,50
db 1,34,33,36,49,2,49,2
db 33,34,1,36,17,18,1,66
db 33,2,1,2,1,36,1,2
db 1,2,1,2,1,2,49,66
db 36,18,1,18,33,18,1,2
db 17,84,2,17,2,1,2,1
db 2,1,2,1,2,1,84,2
db 17,18,17,2,16
kamni:
db 210,0,0,0,0,0,255,0
db 0,128,0,64,128,255,64,128
db 128,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,2,33,2,1
db 2,35,1,2,1,34,17,18
db 1,18,1,2,17,51,1,2
db 33,2,1,2,33,2,1,67
db 4,3,2,1,2,1,18,33
db 2,17,2,83,4,17,18,17
db 50,17,131,2,33,18,1,18
db 17,83,20,3,18,1,18,65
db 2,67,4,19,4,3,18,17
db 82,99,4,35,2,49,18,1
db 18,1,2,1,2,17,35,4
db 2,1,2,65,2,1,18,1
db 2,17,2,17,34,1,66,1
db 18,17,2,17,2,17,2,33
db 2,1,18,1,2,1,2,19
db 1,2,1,18,1,18,19,2
db 33,18,35,4,3,18,17,2
db 1,67,2,1,2,99,1,2
db 17,2,35,4,3,34,35,4
db 3,4,3,1,2,17,83,1
db 67,20,19,4,3,2,17,51
db 4,115,4,35,2,1,83,4
db 67,34,33,2,35,1,3,4
db 19,1,18,1,2,17,2,17
db 50,17,2,1,2,1,2,1
db 2,1,2,1,2,17,2,17
db 2,17,18,17,2,16
drevo:
db 240,0,0,0,0,0,255,0
db 0,128,0,255,0,128,0,64
db 128,64,128,128,128,0,128,255
db 128,128,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,8,0,2,33,2,1
db 2,19,1,35,34,17,18,1
db 18,1,2,17,3,38,7,22
db 3,1,2,1,2,33,2,1
db 19,7,6,23,6,23,3,6
db 18,33,2,17,2,3,7,19
db 6,3,54,7,19,50,33,3
db 22,7,6,3,6,7,22,3
db 23,2,1,18,17,22,7,6
db 7,3,7,3,7,22,7,6
db 35,17,35,54,55,6,23,22
db 19,18,19,7,3,7,6,7
db 22,7,3,22,3,22,7,3
db 18,19,23,3,182,3,33,3
db 22,3,7,6,7,6,7,22
db 7,6,7,22,3,34,7,22
db 7,22,3,39,38,7,6,7
db 19,2,1,3,7,6,23,38
db 7,38,39,6,7,3,1,2
db 19,54,3,38,3,70,3,2
db 1,2,1,3,7,6,7,19
db 4,5,4,19,6,7,6,3
db 1,50,1,34,3,1,36,17
db 3,22,2,49,2,33,34,21
db 4,33,18,1,66,33,2,1
db 52,17,2,1,2,1,2,1
db 2,49,18,20,5,4,5,4
db 18,1,18,33,18,1,2,1
db 132,1,2,1,2,1,2,1
db 2,1,36,5,20,5,4,21
db 36,17,2,16
bum41:
db 141,0,0,0,0,128,255,255
db 0,255,255,0,0,255,128,0
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,80,21,50,21
db 16,5,96,21,130,69,32,50
db 33,4,1,66,0,21,16,5
db 34,1,2,17,18,1,66,53
db 34,17,2,17,18,1,18,4
db 18,37,50,33,2,33,2,17
db 50,21,2,4,18,65,50,1
db 50,5,50,33,2,49,2,17
db 50,21,2,81,18,33,2,17
db 130,113,2,17,130,33,18,1
db 194,65,2,33,66,4,2,5
db 65,2,97,34,1,18,5,18
db 1,34,1,18,1,2,17,18
db 1,34,21,2,4,17,34,49
db 82,37,18,1,18,49,34,4
db 50,37,50,1,18,49,66,53
db 0,66,1,114,37,64,18,17
db 2,4,50,69,80,5,82,53
db 64
bum31:
db 114,0,0,0,0,128,255,255
db 0,255,255,0,0,255,128,0
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,80,53,18,21
db 144,53,82,85,48,5,18,3
db 18,4,66,5,0,21,16,21
db 146,4,18,85,3,18,3,2
db 49,82,53,98,3,66,1,18
db 53,178,3,1,4,18,21,2
db 3,114,3,50,1,18,21,34
db 4,50,3,130,21,210,3,18
db 3,98,3,194,21,130,3,114
db 21,18,4,18,3,146,3,2
db 21,2,3,114,3,34,1,18
db 37,34,3,2,4,98,4,2
db 3,2,53,226,101,50,4,98
db 69,0,37,146,53,80,37,2
db 3,18,101,80,165,64
bum21:
db 134,0,0,0,0,128,255,255
db 0,255,255,0,0,255,128,0
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,80,117,144,69
db 50,101,48,37,34,4,50,21
db 0,21,16,37,130,4,2,133
db 18,4,49,66,101,66,19,2
db 3,18,1,18,69,18,4,18
db 3,2,3,18,19,1,4,2
db 69,34,35,2,83,1,18,53
db 2,4,2,3,18,3,2,3
db 2,3,2,3,18,4,53,34
db 99,2,19,34,53,34,3,2
db 19,2,51,18,4,2,53,2
db 4,1,51,2,3,18,19,34
db 53,2,4,18,3,2,83,2
db 4,18,69,66,19,2,3,34
db 1,2,101,18,4,98,4,2
db 133,82,4,34,165,18,4,66
db 101,0,85,50,101,80,213,80
db 165,64
bum11:
db 79,0,0,0,0,128,255,255
db 0,255,255,0,0,255,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,4,0,80,100,176,196
db 80,196,0,20,16,100,50,100
db 0,84,2,49,18,1,164,34
db 51,18,1,148,2,115,1,2
db 116,2,147,1,100,1,2,147
db 18,84,1,2,147,2,1,84
db 18,147,2,1,100,1,147,1
db 2,100,18,115,2,1,132,34
db 51,34,1,148,130,196,50,116
db 0,228,36,32,228,20,80,196
db 96,164,64
baza1:
db 192,0,0,0,0,0,255,0
db 0,128,0,255,0,128,255,128
db 128,255,0,0,255,128,0,255
db 255,0,128,0,255,0,0,255
db 0,255,255,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,11,0,2,33,2,1
db 2,1,2,17,2,1,34,17
db 18,1,18,1,2,49,2,17
db 2,33,2,1,2,17,232,9
db 4,17,2,8,201,8,3,9
db 4,2,1,8,41,150,8,19
db 9,2,1,57,6,101,7,6
db 8,3,10,3,9,2,8,41
db 6,5,84,7,6,8,35,9
db 2,8,41,6,5,84,7,6
db 8,35,9,2,8,41,6,5
db 84,7,6,8,3,21,9,1
db 8,41,6,5,84,7,6,8
db 3,21,9,2,8,41,6,5
db 84,7,6,8,35,9,2,8
db 41,6,5,103,6,8,3,10
db 3,9,1,8,57,134,8,35
db 9,1,8,201,8,3,10,3
db 9,2,232,35,9,2,9,131
db 10,19,10,3,9,4,3,9
db 1,2,25,19,22,131,9,4
db 9,33,9,35,22,131,25,1
db 18,1,233,9,2,1,2,1
db 2,1,2,17,2,17,2,17
db 18,17,2,16
;-----------------------------------
;-----here begin levels-------------
;-----------------------------------
lev01:
db 171,0
db 225,225,33,150,7,2,1,7
db 41,192,17,150,18,1,57,144
db 1,16,17,182,1,57,112,33
db 16,17,38,225,65,96,17,6
db 1,6,1,7,5,80,1,7
db 117,1,96,17,38,1,18,80
db 1,69,24,21,1,96,17,38
db 1,112,1,34,40,37,1,96
db 17,38,128,1,19,224,17,38
db 1,112,1,0,3,96,1,96
db 17,38,1,224,32,1,96,17
db 38,1,224,32,65,0,49,38
db 129,0,145,6,7,6,1,32
db 17,86,48,1,148,70,1,32
db 17,86,48,1,148,22,1,22
db 1,32,17,6,1,54,4,3
db 16,1,116,16,70,1,32,17
db 70,35,16,1,20,17,36,32
db 70,1,8,7,8,17,70,66
db 1,100,112,1,40,17,70,2
db 7,34,1,116,96,1,40,225
db 225,33,16
lev02:
db 255,3
db 225,225,33,5,49,3,225,161
db 5,38,5,3,64,89,0,40
db 54,50,33,5,38,5,3,32
db 35,34,3,16,8,67,6,50
db 33,5,38,5,3,34,16,3
db 36,3,2,35,36,3,66,33
db 5,22,21,3,34,3,0,3
db 36,3,2,3,7,36,5,3
db 2,1,35,33,5,22,21,3
db 7,2,0,2,19,5,20,3
db 2,51,21,3,66,33,5,22
db 21,35,0,2,3,7,5,20
db 18,3,24,3,22,67,2,33
db 5,17,25,48,2,51,2,35
db 24,3,22,9,16,19,2,33
db 5,2,1,25,49,2,3,56
db 3,54,67,0,3,16,33,5
db 2,49,22,1,6,3,22,1
db 8,3,17,88,3,48,33,5
db 18,4,54,1,6,3,22,1
db 8,3,7,1,99,57,33,5
db 18,4,22,1,5,1,54,1
db 8,3,70,51,57,33,5,18
db 4,0,17,5,113,51,0,3
db 38,9,32,33,5,17,4,16
db 1,32,1,37,49,32,3,54
db 19,0,33,5,0,20,16,1
db 2,1,0,20,1,24,34,0
db 33,7,38,3,16,33,5,0
db 33,0,1,2,113,18,32,83
db 16,33,5,16,7,16,1,146
db 33,128,33,114,65,98,225,225
db 193,16
lev03:
db 118,0
db 225,225,33,85,50,35,162,86
db 17,5,7,53,166,34,7,8
db 18,86,17,85,34,19,6,19
db 50,72,2,86,193,6,225,1
db 6,33,160,230,54,17,18,128
db 102,65,102,17,7,2,128,102
db 1,166,17,160,230,54,225,113
db 6,145,214,224,0,17,214,96
db 81,32,17,214,96,1,7,38
db 17,16,17,214,224,0,113,6
db 225,145,82,198,1,144,17,82
db 1,182,1,48,1,54,0,17
db 18,38,2,7,2,166,1,48
db 1,54,0,17,114,230,6,1
db 7,48,225,225,33,16
lev04:
db 146,0
db 225,225,33,89,1,176,89,1
db 57,17,89,1,176,25,7,41
db 1,57,17,89,1,9,65,57
db 64,34,1,25,1,9,17,89
db 1,25,7,5,9,1,57,48
db 35,33,9,1,9,17,89,1
db 73,1,233,1,9,17,89,225
db 113,9,17,233,233,17,233,233
db 17,217,129,105,17,217,1,100
db 1,105,17,41,81,64,1,7
db 73,4,1,105,17,41,1,7
db 41,1,64,1,89,4,1,105
db 17,41,1,36,25,64,1,25
db 1,41,4,145,41,1,52,1
db 64,41,1,7,34,1,98,17
db 41,81,64,129,18,7,50,17
db 233,121,3,20,50,17,233,121
db 35,17,25,17,233,233,225,225
db 33,16
lev05:
db 229,0
db 225,225,33,224,224,17,0,134
db 50,72,34,24,2,40,2,0
db 17,0,134,34,83,2,56,2
db 40,2,0,17,0,134,18,19
db 56,3,2,24,2,8,2,56
db 0,17,0,22,8,86,19,6
db 72,3,40,2,8,2,56,0
db 17,0,22,8,50,22,18,6
db 40,35,2,24,2,8,2,56
db 0,17,0,22,72,22,18,54
db 3,6,56,2,8,2,32,8
db 0,17,0,40,86,18,40,6
db 3,6,88,2,7,8,0,8
db 0,17,0,40,6,7,70,2
db 40,6,3,54,8,54,8,0
db 8,0,17,0,56,38,8,22
db 40,7,86,8,54,8,0,8
db 0,17,0,2,51,56,6,40
db 2,166,8,0,8,0,17,0
db 50,3,34,8,6,40,2,6
db 66,70,16,8,0,17,0,18
db 7,2,72,22,7,8,0,6
db 66,70,0,24,0,17,0,6
db 51,120,0,6,66,8,54,0
db 24,0,17,0,118,3,64,6
db 104,22,7,0,24,0,17,0
db 118,83,6,136,16,24,0,17
db 0,230,22,19,136,0,17,224
db 224,225,225,33,16
lev06:
db 149,0
db 225,225,33,176,1,18,19,192
db 17,0,7,18,112,1,2,7
db 2,16,3,160,17,0,34,112
db 1,18,51,160,17,0,1,144
db 97,160,17,0,1,224,192,17
db 0,1,224,192,17,0,145,48
db 230,17,48,7,66,1,48,209
db 6,17,48,82,1,48,1,68
db 96,22,17,144,1,48,1,4
db 7,18,3,96,22,17,144,1
db 48,1,4,34,3,48,7,41
db 6,17,144,1,48,1,20,96
db 57,6,17,16,129,48,1,20
db 96,4,41,6,17,16,1,40
db 50,64,1,128,4,32,6,17
db 16,1,7,8,66,64,145,4
db 32,6,17,16,177,144,1,70
db 17,224,128,1,70,17,224,144
db 70,225,225,33,16
lev07:
db 159,0
db 225,225,33,0,7,229,197,17
db 64,225,113,21,17,64,1,37
db 134,133,1,21,17,32,33,37
db 6,37,33,7,6,133,1,21
db 17,37,1,37,1,5,134,133
db 1,21,17,133,209,5,49,21
db 17,5,1,229,197,17,5,1
db 133,1,229,37,17,5,1,85
db 1,229,85,17,5,65,21,1
db 21,1,101,113,38,17,5,1
db 32,37,1,149,1,7,8,53
db 1,38,17,5,1,8,16,37
db 1,21,1,7,85,1,3,2
db 53,1,38,17,5,1,8,16
db 21,193,3,69,1,38,17,5
db 1,8,1,0,229,3,69,1
db 38,17,5,1,7,232,117,1
db 38,17,5,1,232,8,129,38
db 17,5,225,33,7,98,38,17
db 229,69,150,225,225,33,16
lev08:
db 209,0
db 225,225,33,36,7,228,84,1
db 48,17,164,195,4,1,48,17
db 164,3,166,3,4,1,0,7
db 2,0,17,164,3,166,3,4
db 1,0,18,0,17,165,3,166
db 3,4,1,48,17,165,3,166
db 3,4,1,48,17,165,3,166
db 3,4,1,48,17,54,3,82
db 3,6,1,4,99,6,3,4
db 1,48,17,54,3,82,3,6
db 1,4,3,7,21,22,3,6
db 3,4,1,0,7,2,0,17
db 6,7,22,3,82,3,6,1
db 4,3,37,22,3,6,3,4
db 1,0,18,0,17,54,3,82
db 3,6,1,4,3,70,3,6
db 3,4,1,48,17,54,3,82
db 3,6,1,4,3,6,67,6
db 3,4,1,48,17,54,115,6
db 1,4,3,102,3,4,1,48
db 17,198,1,4,3,102,3,4
db 1,48,17,6,161,2,1,4
db 3,102,3,4,1,48,17,6
db 7,130,1,2,1,4,131,4
db 1,48,17,38,114,1,2,193
db 48,17,38,226,178,225,225,33
db 16
lev09:
db 162,0
db 225,225,33,229,5,214,17,21
db 33,7,149,1,198,17,21,208
db 1,32,150,17,226,2,1,18
db 80,70,17,2,83,130,1,18
db 0,7,34,0,70,17,2,3
db 144,1,0,18,1,18,0,50
db 0,70,17,2,3,144,1,0
db 18,1,18,0,50,0,70,17
db 2,3,32,7,50,16,1,0
db 66,0,50,0,70,17,2,3
db 32,66,16,1,0,66,0,7
db 130,17,2,3,144,1,48,18
db 64,82,17,18,144,1,0,7
db 50,0,2,32,82,17,18,144
db 1,0,66,0,1,64,50,17
db 178,1,0,66,0,2,80,34
db 17,178,1,96,6,80,34,145
db 0,34,113,150,17,7,82,1
db 0,34,230,38,17,98,16,226
db 82,17,98,16,226,82,225,225
db 33,16
lev10:
db 205,0
db 225,225,33,224,224,17,0,2
db 83,64,233,9,0,17,0,2
db 3,34,0,7,64,233,9,0
db 17,0,2,3,34,96,73,7
db 153,0,17,224,32,1,41,50
db 41,0,17,2,145,16,18,32
db 1,41,50,41,0,17,2,1
db 134,16,18,32,1,41,50,41
db 0,17,2,1,6,41,70,16
db 1,2,32,1,7,25,50,41
db 0,17,2,1,6,89,22,16
db 18,32,49,50,41,0,17,2
db 1,6,89,22,16,1,2,32
db 1,41,50,41,0,17,2,1
db 54,41,22,16,1,2,32,1
db 41,50,41,0,17,2,1,54
db 41,22,16,1,2,32,1,41
db 50,41,0,17,2,1,54,7
db 25,22,16,18,32,1,41,2
db 7,16,41,0,17,2,1,54
db 41,22,16,1,2,224,17,2
db 1,54,41,22,16,1,2,224
db 17,2,1,134,16,18,100,6
db 98,17,2,1,160,1,2,100
db 6,1,82,17,226,118,1,7
db 66,225,225,33,16
lev11:
db 228,0
db 225,225,33,230,230,17,6,104
 
db 1,104,6,1,7,152,6,17
 
db 6,104,1,104,6,1,24,1
 
db 120,6,17,6,104,1,8,102
 
db 49,8,64,24,6,17,6,104
 
db 1,8,6,72,38,40,0,88
 
db 6,17,6,8,97,8,6,33
 
db 56,6,40,64,24,6,17,6
 
db 8,1,104,6,1,64,1,6
 
db 104,0,24,6,17,6,8,1
 
db 104,6,1,0,40,0,1,6
 
db 104,0,24,6,17,6,8,1
 
db 7,88,6,1,0,40,0,1
 
db 6,40,16,24,0,24,6,17
 
db 6,8,33,72,6,1,0,8
 
db 7,8,0,1,6,40,0,40
 
db 0,24,6,17,6,136,6,1
 
db 0,40,0,1,6,40,0,40
 
db 0,24,6,17,166,1,0,40
 
db 0,1,6,40,64,7,8,6
 
db 17,6,8,49,6,56,1,64
 
db 1,6,152,6,17,6,8,7
 
db 24,1,6,56,97,182,17,6
 
db 56,1,6,168,6,24,80,40
 
db 17,6,56,1,198,24,0,56
 
db 0,40,17,6,72,6,216,0
 
db 56,0,40,17,102,120,1,7
 
db 56,0,1,7,8,1,0,40
 
db 225,225,33,16
lev12:
db 157,0
db 225,225,33,66,1,217,36,98
 
db 17,66,1,217,36,50,3,18
 
db 17,66,1,41,161,36,33,50
 
db 17,66,1,41,1,196,1,2
 
db 1,50,17,66,1,41,1,196
 
db 1,2,1,50,17,2,65,41
 
db 1,148,49,2,1,50,17,2
 
db 1,7,24,25,33,4,145,7
 
db 34,1,50,17,2,1,40,25
 
db 1,7,20,1,7,178,1,50
 
db 17,2,97,32,1,194,1,50
 
db 17,162,1,194,1,50,17,162
 
db 1,2,3,18,145,50,209,2
 
db 3,18,1,7,178,17,7,36
 
db 19,98,3,18,1,98,3,66
 
db 17,68,3,4,130,1,194,17
 
db 36,35,4,130,1,194,17,114
 
db 129,34,3,82,3,18,17,18
 
db 3,66,1,7,226,66,17,226
 
db 226,225,225,33,16
lev13:
db 233,0
db 225,225,33,224,224,17,0,53
 
db 225,49,16,1,21,0,17,0
 
db 53,1,230,22,1,16,1,21
 
db 0,17,0,53,1,230,22,1
 
db 16,1,21,0,17,0,53,1
 
db 38,177,22,1,16,1,21,0
 
db 17,0,5,1,21,1,38,1
 
db 7,133,1,22,1,16,1,21
 
db 0,17,0,5,1,21,1,38
 
db 1,6,1,7,101,1,22,1
 
db 16,1,21,0,17,0,5,1
 
db 21,1,70,1,117,1,22,1
 
db 16,1,21,0,17,0,5,1
 
db 21,1,38,1,6,1,5,7
 
db 85,1,22,1,16,1,21,0
 
db 17,0,5,1,21,1,38,1
 
db 38,81,5,1,38,16,1,21
 
db 0,17,0,5,1,21,1,38
 
db 1,70,7,53,1,22,1,16
 
db 1,7,5,0,17,0,5,1
 
db 21,1,38,177,22,1,16,1
 
db 21,0,17,0,5,1,21,1
 
db 230,22,1,16,1,21,0,17
 
db 0,5,1,21,1,7,230,6
 
db 1,16,1,21,0,17,0,5
 
db 1,21,225,49,16,1,21,0
 
db 17,0,5,1,7,5,224,80
 
db 1,21,0,17,0,5,225,145
 
db 21,0,17,224,224,225,225,33
 
db 16
lev14:
db 152,0
db 225,225,33,7,102,144,57,112
 
db 17,118,48,7,40,16,7,41
 
db 112,17,118,0,104,208,17,22
 
db 49,232,128,17,22,1,25,1
 
db 8,196,8,128,17,22,1,25
 
db 1,8,196,8,128,17,38,0
 
db 9,1,8,20,7,148,8,128
 
db 17,6,32,9,1,8,196,72
 
db 64,17,6,0,41,1,8,196
 
db 72,64,17,6,0,41,1,8
 
db 196,8,7,40,64,17,6,32
 
db 9,1,232,128,17,70,1,0
 
db 81,120,128,17,64,1,80,1
 
db 224,16,17,64,1,89,1,16
 
db 86,32,70,0,17,80,89,1
 
db 16,86,32,70,0,17,86,1
 
db 7,57,1,32,70,32,70,0
 
db 17,7,70,97,118,32,70,0
 
db 17,230,86,128,225,225,33,16
 
lev15:
db 242,0
db 225,225,33,182,224,32,17,22
 
db 69,70,0,54,0,54,0,54
 
db 0,20,17,22,69,32,22,0
 
db 54,0,54,0,54,0,20,17
 
db 22,69,0,5,4,22,0,1
 
db 38,0,54,0,54,0,20,17
 
db 22,69,0,3,4,22,0,1
 
db 38,0,54,0,33,6,0,20
 
db 17,22,69,0,3,4,22,0
 
db 17,7,6,0,54,0,1,7
 
db 22,0,20,17,22,69,0,3
 
db 4,22,0,1,38,0,54,0
 
db 1,38,0,20,17,22,80,3
 
db 4,22,0,1,38,0,54,0
 
db 1,38,0,20,17,22,0,83
 
db 4,22,0,54,0,54,0,49
 
db 0,20,17,22,0,3,84,22
 
db 0,54,0,56,0,54,0,20
 
db 17,22,0,3,84,22,0,54
 
db 0,56,0,54,0,20,17,22
 
db 0,3,7,68,22,0,54,0
 
db 8,7,24,0,54,0,25,17
 
db 22,0,83,4,22,0,54,0
 
db 56,0,54,0,7,9,17,22
 
db 112,22,0,54,0,54,0,54
 
db 0,25,17,182,0,54,0,54
 
db 0,54,0,20,17,192,54,0
 
db 54,0,54,0,20,225,1,7
 
db 22,0,54,0,54,0,20,17
 
db 7,2,116,224,32,20,225,225
 
db 33,16
 
;-----------------------------------
spisok:
dd sten1
dd sten3
dd trava
dd kamni
dd palma
dd water
dd voda1
dd baza1
dd drevo
dd pesok
dd bum11; here begin animate sprites
dd bum21
dd bum31
dd bum41
dd puly1
dd puly1
dd puly1
dd puly1
dd tan11
dd tan12
dd tan11
dd tan12
dd tan21
dd tan22
dd tan21
dd tan22
;-----------------------------------
levels:
dd lev01
dd lev02
dd lev03
dd lev04
dd lev05
dd lev06
dd lev07
dd lev08
dd lev09
dd lev10
dd lev11
dd lev12
dd lev13
dd lev14
dd lev15
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/telnet/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm telnet.asm telnet
@pause
/programs/telnet/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm telnet.asm telnet
@pause
/programs/telnet/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/telnet/trunk/telnet.asm
0,0 → 1,818
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; TERMINAL
;
; 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'
 
START: ; start of execution
 
; Clear the screen memory
mov eax, ' '
mov edi,text
mov ecx,80*30 /4
cld
rep stosd
 
 
call draw_window
 
 
still:
; 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 draw_window
 
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
 
 
 
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
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,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, 2 ; Set IP
jne notip
 
mov [string_x], dword 78
mov [string_y], dword 276
mov [string_length], dword 15
call read_string
mov esi,string-1
mov edi,ip_address
xor eax,eax
ip1:
inc esi
cmp [esi],byte '0'
jb ip2
cmp [esi],byte '9'
jg ip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp ip1
ip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,ip_address+3
jbe ip1
call draw_window
 
 
jmp still
 
notip:
cmp ah, 3 ; set port
jne notport
 
mov [string_x], dword 215
mov [string_y], dword 276
mov [string_length], dword 4
call read_string
mov esi,string-1
mov edi,port
xor eax,eax
ip11:
inc esi
cmp [esi],byte '0'
jb ip21
cmp [esi],byte '9'
jg ip21
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp ip11
ip21:
mov [edi],al
inc edi
mov [edi],ah
call draw_window
 
 
jmp still
 
notport:
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: ; Echo Toggle
cmp ah, 6
jne still
 
mov al, [echo]
not al
mov [echo], al
 
call draw_window
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,0 ; DRAW WINDOW
mov ebx,100*65536+491 + 8 +15
mov ecx,100*65536+270 + 20 ; 20 for status bar
mov edx,[wcolor]
add edx,0x02000000
mov esi,0x80557799
mov edi,0x00557799
int 0x40
 
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x00ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
 
 
mov eax,8 ; CLOSE BUTTON
mov ebx,(491 + 20 -19)*65536+12
 
mov ecx,5*65536+12
mov edx,1
mov esi,0x557799
int 0x40
 
; draw status bar
mov eax, 13
mov ebx, 4*65536+484 + 8 +15
mov ecx, 270*65536 + 3
mov edx, 0x00557799
int 0x40
 
mov eax,8 ; BUTTON 2: SET IP
mov ebx,4*65536+70
mov ecx,273*65536+12
mov esi, 0x00557799
mov edx,2
int 0x40
 
mov eax,4 ; Button text
mov ebx,6*65536+276
mov ecx,0x00ffffff
mov edx,setipt
mov esi,setiplen-setipt
int 0x40
 
 
mov edi,ip_address ; display IP address
mov edx,78*65536+276
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,ip_address+4
jb ipdisplay
 
mov eax,8 ; BUTTON 3: SET PORT
mov ebx,173*65536+38
mov ecx,273*65536+12
mov edx,3
mov esi, 0x00557799
int 0x40
 
mov eax,4 ; Button text
mov ebx,178*65536+276
mov ecx,0x00ffffff
mov edx,setportt
mov esi,setportlen-setportt
int 0x40
 
 
mov edx,216*65536+276 ; display port
mov esi,0x00ffffff
mov ebx,4*65536
mov eax,47
movzx ecx,word [port]
int 0x40
 
mov eax,8 ; BUTTON 4: Connect
mov ebx,250*65536+50
mov ecx,273*65536+12
mov esi, 0x00557799
mov edx,4
int 0x40
 
mov eax,4 ; Button text
mov ebx,255*65536+276
mov ecx,0x00ffffff
mov edx,cont
mov esi,conlen-cont
int 0x40
 
 
mov eax,8 ; BUTTON 5: disconnect
mov ebx,303*65536+70
mov ecx,273*65536+12
mov edx,5
mov esi, 0x00557799
int 0x40
 
 
mov eax,4 ; Button text
mov ebx,307*65536+276
mov ecx,0x00ffffff
mov edx,dist
mov esi,dislen-dist
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,380*65536+276
mov ecx,0x00ffffff
int 0x40
 
 
mov eax,8 ; BUTTON 6: echo
mov ebx,460*65536+50
mov ecx,273*65536+12
mov edx,6
mov esi, 0x00557799
int 0x40
 
mov edx,echot
mov esi,echolen-echot
mov al, [echo]
cmp al, 0
jne peo
mov edx,echoot
mov esi,echoolen-echoot
 
peo:
mov eax,4 ; Button text
mov ebx,463*65536+276
mov ecx,0x00ffffff
int 0x40
 
 
xor eax,eax
mov edi,text+80*30
mov ecx,80*30 /4
cld
rep stosd
 
call draw_text
 
mov eax,12
mov ebx,2
int 0x40
 
popa
 
ret
 
 
draw_text:
 
pusha
 
mov esi,text
mov eax,0
mov ebx,0
newletter:
mov cl,[esi]
cmp cl,[esi+30*80]
jne yesletter
jmp noletter
yesletter:
mov [esi+30*80],cl
 
; erase character
 
pusha
mov edx, 0 ; bg colour
mov ecx, ebx
add ecx, 26
shl ecx, 16
mov cx, 9
mov ebx, eax
add ebx, 6
shl ebx, 16
mov bx, 6
mov eax, 13
int 0x40
popa
 
; draw character
 
pusha
mov ecx, 0x00ffffff
push bx
mov ebx,eax
add ebx,6
shl ebx,16
pop bx
add bx,26
mov eax,4
mov edx,esi
mov esi,1
int 0x40
popa
 
noletter:
 
add esi,1
add eax,6
cmp eax,80*6
jb newletter
mov eax,0
add ebx,10
cmp ebx,24*10
jb newletter
 
popa
ret
 
 
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,0x00000000
int 0x40
 
mov eax,4
mov ebx,[string_x]
shl ebx,16
add ebx,[string_y]
mov ecx,0x00ffffff
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 001,002,003,004
port db 0,0
echo db 0
socket dd 0x0
socket_status dd 0x0
pos dd 80 * 1
scroll dd 1
dd 24
wcolor dd 0x000000
labelt db 'Telnet v0.1'
labellen:
setipt db 'IP Address: . . .'
setiplen:
setportt db 'Port:'
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:
 
 
 
text:
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/template/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm template.asm template
@pause
/programs/template/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm template.asm template
@pause
/programs/template/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/template/trunk/template.asm
0,0 → 1,102
; <--- description --->
; compiler: FASM 1.50
; name: Basic window example for MenuetOS
; version: 1.01
; last update: 25/08/2004
; written by: Ivan Poddubny
; e-mail: ivan-yar@bk.ru
 
 
; <--- include all MeOS stuff --->
include "lang.inc"
include "macros.inc"
 
 
; <--- start of MenuetOS application --->
MEOS_APP_START
 
 
; <--- start of code --->
CODE
call draw_window ; at first create and draw the window
 
wait_event: ; main cycle
mov eax, 10
int 0x40
 
cmp eax, 1 ; if event == 1
je redraw ; jump to redraw handler
cmp eax, 2 ; else if event == 2
je key ; jump to key handler
cmp eax, 3 ; else if event == 3
je button ; jump to button handler
 
jmp wait_event ; else return to the start of main cycle
 
 
redraw: ; redraw event handler
call draw_window
jmp wait_event
 
 
key: ; key event handler
mov eax, 2 ; get key code
int 0x40
 
jmp wait_event
 
 
button: ; button event handler
mov eax, 17 ; get button identifier
int 0x40
 
cmp ah, 1
jne wait_event ; return if button id != 1
 
or eax, -1 ; exit application
int 0x40
 
 
draw_window:
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
 
mov eax, 0 ; create and draw the window
mov ebx, 100*65536+300 ; (window_cx)*65536+(window_sx)
mov ecx, 100*65536+200 ; (window_cy)*65536+(window_sy)
mov edx, 0x03ffffff ; work area color & window type 3
; mov esi, 0 ; grab color (not used)
; mov edi, 0 ; frame color (not used)
int 0x40
 
mov eax, 4 ; window header
mov ebx, 8*65536+8 ; coordinates
mov ecx, 0x10ffffff ; color & font N1
mov edx, header ; address of text
mov esi, header.size ; length of text
int 0x40
 
mov eax, 12 ; finish drawing
mov ebx, 2
int 0x40
 
ret
 
 
 
; <--- initialised data --->
DATA
lsz header,\
ru, "˜ ¡«®­ ¯à®£à ¬¬ë",\
en, "Template program",\
fr, "La programme poncive"
 
 
 
; <--- uninitialised data --->
UDATA
 
 
MEOS_APP_END
; <--- end of MenuetOS application --->
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/terminal/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm terminal.asm terminal
@pause
/programs/terminal/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm terminal.asm terminal
@pause
/programs/terminal/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/terminal/trunk/terminal.asm
0,0 → 1,764
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; TERMINAL
;
; 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'
START: ; start of execution
call draw_window
call set_variables
still:
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
cmp eax,16+4
je read_input
jmp still
read_input:
push ecx
mov eax,42
mov ebx,4
int 0x40
pop ecx
cmp bl,27 ; ESCAPE COMMAND
jne no_esc
call esc_command
jmp newdata
no_esc:
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
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,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]
call draw_data
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 esi,text+80+60*80
mov edi,text+60*80
mov ecx,ebx
cld
rep movsb
mov eax,ebx
sub eax,80
noeaxz:
mov [pos],eax
newdata:
mov eax,11
int 0x40
cmp eax,16+4
je read_input
call draw_text
jmp still
red: ; REDRAW WINDOW
call draw_window
jmp still
key: ; KEY
mov eax,2 ; send to modem
int 0x40
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:
mov ecx,0x3f8
mov bl,al
mov eax,43
int 0x40
jmp still
button: ; BUTTON
mov eax,17
int 0x40
cmp ah,1 ; CLOSE PROGRAM
jne noclose
mov eax,45 ; FREE IRQ
mov ebx,1
mov ecx,4
int 0x40
mov eax,46
mov ebx,1
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
mov eax,-1
int 0x40
noclose:
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
mov ecx,0x3f8
mov ebx,eax
mov eax,43
int 0x40
mov eax,5
mov ebx,5
int 0x40
popa
ret
draw_data:
pusha
cmp bl,0xe4 ; Á
jne noe4
mov bl,0xc1
noe4:
cmp bl,0xc4 ; É
jne noc4
mov bl,0xc9
noc4:
mov [eax+text],bl
mov bl,byte [attribute]
mov [eax+text+60*80],bl
popa
ret
irqtable:
dd 0x3f8 + 0x01000000 ; read port 0x3f8, byte
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
set_variables:
pusha
mov eax,46
mov ebx,0
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
mov eax,45 ; reserve irq 4
mov ebx,0
mov ecx,4
int 0x40
mov eax,44
mov ebx,irqtable
mov ecx,4
int 0x40
; jmp noportint
mov cx,0x3f8+3
mov bl,0x80
mov eax,43
int 0x40
mov cx,0x3f8+1
mov bl,0
mov eax,43
int 0x40
mov cx,0x3f8+0
mov bl,0x30 / 16
mov eax,43
int 0x40
mov cx,0x3f8+3
mov bl,3
mov eax,43
int 0x40
mov cx,0x3f8+4
mov bl,0xB
mov eax,43
int 0x40
mov cx,0x3f8+1
mov bl,1
mov eax,43
int 0x40
noportint:
mov eax,40
mov ebx,0000000000010000b shl 16 + 111b
int 0x40
popa
ret
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
pusha
mov eax,12
mov ebx,1
int 0x40
mov eax,0 ; DRAW WINDOW
mov ebx,100*65536+491
mov ecx,100*65536+270
mov edx,[wcolor]
add edx,0x02000000
mov esi,0x80557799
mov edi,0x00557799
int 0x40
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x00ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
mov eax,8 ; CLOSE BUTTON
mov ebx,(491-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x557799
int 0x40
xor eax,eax
mov edi,text+80*30
mov ecx,80*30 /4
cld
rep stosd
call draw_text
mov eax,12
mov ebx,2
int 0x40
popa
ret
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
draw_text:
pusha
mov esi,text
mov eax,0
mov ebx,0
newletter:
mov cl,[esi]
mov dl,[esi+60*80]
cmp cl,[esi+30*80]
jne yesletter
cmp dl,[esi+90*80]
jne yesletter
jmp noletter
yesletter:
mov [esi+30*80],cl
mov [esi+90*80],dl
pusha
and edx,0xff
shl edx,2
add edx,bgc
mov edx,[edx]
mov ecx,ebx
add ecx,26
shl ecx,16
mov cx,9
mov ebx,eax
add ebx,6
shl ebx,16
mov bx,6
mov eax,13
int 0x40
popa
pusha
and edx,0xff
shl edx,2
add edx,tc
mov ecx,[edx]
push bx
mov ebx,eax
add ebx,6
shl ebx,16
pop bx
add bx,26
mov eax,4
mov edx,esi
mov esi,1
int 0x40
popa
noletter:
add esi,1
add eax,6
cmp eax,80*6
jb newletter
mov eax,0
add ebx,10
cmp ebx,24*10
jb newletter
popa
ret
esc_command:
mov eax,32
mov edi,esccmd
mov ecx,10
cld
rep stosb
mov edi,esccmd
newescc:
mov eax,42
mov ebx,4
int 0x40
cmp ecx,0
je escok
mov eax,5
mov ebx,1
int 0x40
jmp newescc
escok:
mov [edi],bl
add edi,1
cmp edi,esccmd+20
je dontunderstand
mov esi,escend
nec:
cmp bl,[esi]
jz com_ok
add esi,1
cmp [esi],byte 0
je newescc
jmp nec
com_ok:
call get_numbers
cmp bl,'H' ; SET CURSOR POSITION
jne no_cursor_position
cmp [escnumbers],0
jne ncp1
mov [pos],dword 0
jmp cmd_done
ncp1:
mov eax,[escnumbers]
dec eax
imul eax,80
add eax,[escnumbers+4]
dec eax
mov [pos],eax
jmp cmd_done
no_cursor_position:
cmp bl,'K' ; ERASE LINE
jne no_erase_end_of_line
cmp [escnumbers],0
jne no_end_line
mov ecx,[pos]
eeol:
mov [ecx+text],byte ' '
mov [ecx+text+60*80],byte 0
add ecx,1
xor edx,edx
mov eax,ecx
mov ebx,80
div ebx
cmp edx,0
jne eeol
jmp cmd_done
no_end_line:
cmp [escnumbers],1 ; BEGINNING OF LINE
jne no_beg_line
mov ecx,[pos]
ebol:
mov [ecx+text],byte ' '
mov [ecx+text+60*80],byte 0
sub ecx,1
xor edx,edx
mov eax,ecx
mov ebx,80
div ebx
cmp edx,0
jne ebol
mov [pos],ecx
jmp cmd_done
no_beg_line:
no_erase_end_of_line:
cmp bl,'J' ; ERASE TO END OF SCREEN
jne no_erase_to_end_of_screen
cmp [escnumbers],dword 0
jne no_erase_to_end_of_screen
mov ecx,[pos]
eteos:
mov [ecx+text],byte ' '
mov [ecx+text+60*80],byte 0
add ecx,1
cmp ecx,80*24+1
jb eteos
jmp cmd_done
no_erase_to_end_of_screen:
cmp bl,'r' ; SET SCROLL REGION
jne no_scroll_region
mov eax,[escnumbers]
dec eax
mov [scroll+0],eax
mov eax,[escnumbers+4]
mov [scroll+4],eax
jmp cmd_done
no_scroll_region:
cmp bl,'A' ; CURSOR UP
jne no_cursor_up
mov eax,[pos]
sub eax,80
mov [pos],eax
jmp cmd_done
no_cursor_up:
cmp bl,'C' ; CURSOR LEFT
jne no_cursor_left
mov eax,[pos]
mov ebx,[escnumbers]
sub eax,ebx
mov [pos],eax
call cmd_done
no_cursor_left:
cmp bl,'m' ; CHARACTER ATTRIBUTE
jne no_char_attribute
mov eax,[escnumbers]
mov [attribute],eax
jmp cmd_done
no_char_attribute:
cmp bl,'Z' ; TERMINAL TYPE
jne no_terminal_type
mov al,27
call to_modem
mov al,'?'
call to_modem
mov al,'1'
call to_modem
mov al,';'
call to_modem
mov al,'0'
call to_modem
mov al,'c'
call to_modem
jmp cmd_done
no_terminal_type:
dontunderstand:
cmd_done:
ret
draw_numbers:
pusha
mov eax,13
mov ebx,250*65536+100
mov ecx,8*65536+8
mov edx,0x000000
int 0x40
mov eax,[escnumbers]
xor edx,edx
mov ebx,10
div ebx
add eax,48
add edx,48
mov byte [numtext+0],al
mov byte [numtext+1],dl
mov eax,[escnumbers+4]
xor edx,edx
mov ebx,10
div ebx
add eax,48
add edx,48
mov [numtext+3],al
mov [numtext+4],dl
mov eax,4
mov ebx,250*65536+8
mov ecx,0xffffff
mov edx,numtext
mov esi,10
int 0x40
popa
ret
draw_event:
pusha
mov eax,13
mov ebx,150*65536+100
mov ecx,8*65536+8
mov edx,0xffffff
int 0x40
mov eax,4
mov ebx,150*65536+8
mov ecx,0x000000
mov edx,esccmd
mov esi,20
int 0x40
popa
ret
get_numbers:
pusha
mov [escnumbers+0],0
mov [escnumbers+4],0
mov [escnumbers+8],0
mov ecx,esccmd
cmp [ecx+1],byte '0'
jb gn_over
cmp [ecx+1],byte '9'
jg gn_over
mov edi,escnumbers
gn_new:
add ecx,1
movzx eax,byte [ecx]
sub eax,48
add ecx,1
cmp [ecx],byte '0'
jb gnl1
cmp [ecx],byte '9'
jg gnl1
mov ebx,10
xor edx,edx
mul ebx
movzx ebx,byte[ecx]
add eax,ebx
sub eax,48
add ecx,1
gnl1:
mov [edi],eax
add edi,4
cmp [ecx],byte ';'
je gn_new
gn_over:
popa
ret
; DATA AREA
pos dd 80*10
irc_data dd 0x0
print db 0x0
attribute dd 0
scroll dd 1
dd 24
numtext db ' '
esccmd dd 0,0,0,0,0,0,0,0,0,0,0,0,0
escend db 'ZrhlABCDHfDME=>NmKJgincoyq',0
escnumbers dd 0,0,0,0,0
wcolor dd 0x000000
labelt db 'TERMINAL FOR MODEM IN COM1 0.03'
labellen:
text:
db ' '
db ' '
db '*** A TELNET APPLICATION FOR HAYES COMPATIBLE MODEMS IN COM1 '
db ' '
db '*** USE HAYES COMMANDS TO CONNECT TO A SERVER '
db ' '
db '*** ATDT (PHONENUMBER) '
db ' '
db ' '
db ' '
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/block.inc
0,0 → 1,376
;--------------------------------------------------------------
;DRAW BLOCK
;
;--------------------------------------------------------------
draw_block: mov eax,13
mov edx,[color_table+edx*4]
 
mov ebx,[current_block_x]
mov ecx,[current_block_y]
mov edi,[current_block_pointer]
 
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
 
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
 
mov dword [TMP_1],4
adr_122: mov dword [TMP_0],4
adr_121: cmp byte [edi],0
je adr_120
 
int 040h
 
call draw_frames
 
adr_120: inc edi
add ebx,ADOBE_SIZE*65536
dec dword [TMP_0]
jnz adr_121
sub ebx,4*ADOBE_SIZE*65536
add ecx,ADOBE_SIZE*65536
dec dword [TMP_1]
jnz adr_122
 
ret
 
draw_frames:
cmp edx,0
jne df1
ret
df1:
pusha
mov bx,1
add edx,0x282828
mov eax,13
int 0x40
popa
 
pusha
mov cx,1
add edx,0x282828
mov eax,13
int 0x40
popa
 
pusha
push ebx
sub bx,1
add [esp+2],bx
pop ebx
mov bx,1
shr edx,1
and edx,0x7f7f7f
mov eax,13
int 0x40
popa
 
pusha
push ecx
sub cx,1
add [esp+2],cx
pop ecx
mov cx,1
shr edx,1
and edx,0x7f7f7f
mov eax,13
int 0x40
popa
 
ret
 
;-------------------------------------------------------------
; FIX BLOCK
;-------------------------------------------------------------
fix_block: mov ebx,[current_block_pointer]
 
mov edx,[current_block_y]
imul edx,LEN_X
add edx,[current_block_x] ;find the offset in tetris_t
 
add edx,table_tetris
 
mov ecx,4
mov al,[current_block_color]
 
adr_21: cmp byte [ebx],1
jne adr_22
mov [edx],al
adr_22: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_23
mov [edx],al
adr_23: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_24
mov [edx],al
adr_24: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_25
mov [edx],al
adr_25: inc ebx
add edx,LEN_X-3
 
loop adr_21
ret
 
;-------------------------------------------------------------
;NEW BLOCK
;-------------------------------------------------------------
new_block: mov dword [current_block_y],1
mov dword [current_block_x],7
 
mov eax,dword [next_block_pointer]
mov dword [current_block_pointer],eax
 
mov eax,dword [next_block_color]
mov dword [current_block_color],eax
 
call random
and al,7
setz ah
add al,ah
mov [next_block_color],al
 
call random
;and eax,15
; ---- Ivan ----
and eax,0xff
@@:
cmp eax,_MAXBLOCKS_
jl @f
add eax,-(_MAXBLOCKS_)
jmp @b
@@:
; ---- Ivan ----
mov edx,[block_table+eax*4]
mov [next_block_pointer],edx
 
mov dword[delay],5
sub dword[delay],speed
 
ret
 
 
;-------------------------------------------------------------
;DRAW TITLE BLOCK
;-------------------------------------------------------------
draw_title_block:
; movzx edx,byte [current_block_color]
mov eax,13
 
; mov edx,[color_table+edx*4]
 
; mov ebx,[current_block_x]
; mov ecx,[current_block_y]
; mov edi,[current_block_pointer]
 
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
 
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
 
mov dword [TMP_1],5
call adr_122
 
ret
 
;-------------------------------------------------------------
;FIRST BLOCK
;-------------------------------------------------------------
first_block: call random
and al,7
setz ah
add al,ah
mov [next_block_color],al
 
call random
;and eax,15
; ---- Ivan ----
and eax,0xff
@@:
cmp eax,_MAXBLOCKS_
jl @f
add eax,-(_MAXBLOCKS_)
jmp @b
@@:
; ---- Ivan ----
mov edx,[block_table+eax*4]
mov [next_block_pointer],edx
 
; call draw_next_block
 
; mov byte [delay],5 ;19 ;!!! 15
ret
ret
 
;-------------------------------------------------------------
;DRAW NEXT BLOCK
;-------------------------------------------------------------
 
draw_next_block:
movzx edx,byte [next_block_color]
mov eax,13
mov edx,[color_table+edx*4]
 
mov ebx,LEN_X+1
mov ecx,5
mov edi,[next_block_pointer]
 
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
 
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
 
mov dword [TMP_1],4
jmp adr_122
 
ret
 
;-------------------------------------------------------------
; ROTATE BLOCK
;-------------------------------------------------------------
 
rotate_block:
mov edx,[current_block_pointer]
mov edx,[edx+16]
mov esi,[current_block_pointer]
mov [current_block_pointer],edx
call check_crash
call attesa
mov [current_block_pointer],esi
 
ret
 
 
;-------------------------------------------------------------
; CHECK CRASH
; output Z flag => OK
; NZ flag => NO
;-------------------------------------------------------------
 
check_crash: mov ebx,[current_block_pointer]
 
mov edx,[current_block_y]
imul edx,LEN_X
add edx,[current_block_x] ;find the offset in tetris_t
 
add edx,table_tetris
 
mov ecx,4
xor ax,ax
 
adr_1: cmp byte [ebx],1
jne adr_2
add al,[edx]
adc ah,0
adr_2: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_3
add al,[edx]
adc ah,0
adr_3: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_4
add al,[edx]
adc ah,0
adr_4: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_5
add al,[edx]
adc ah,0
adr_5: inc ebx
add edx,LEN_X-3
 
loop adr_1
or ax,ax
ret
 
;--------------------------------------------------------------
;CHECK LINE
;--------------------------------------------------------------
;edx = pointer
;ebx = contatore
check_full_line:
std
mov al,0
mov edx,table_tetris+LEN_X*(LEN_Y-BORDER_BOTTOM)-1
mov ebx,(LEN_Y-BORDER_TOP-BORDER_BOTTOM-1)*LEN_X
 
adr_5000: mov edi,edx
mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT
repne scasb
jz no_full_line
 
lea esi,[edx-LEN_X]
mov edi,edx
mov ecx,ebx
rep movsb
sub edi,BORDER_RIGHT
mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT
rep stosb
 
add dword [score],100
add dword [lines],1
 
; mov esi,dword[score]
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; mov esi,dword [speed]
; imul esi,linestonewlevel
; add esi,linestonewlevel
; cmp dword [lines],esi
; jne adr_5000 1 line : 100
; cmp dword[speed],4 2 lines: 300
; je adr_51 3 lines: 700
; inc dword[speed] 4 lines:1500
; jmp adr_5000
; adr_51:
; mov dword[speed],0
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
jmp adr_5000
 
no_full_line: sub edx,LEN_X
sub ebx,LEN_X
jnz adr_5000
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/blocks.inc
0,0 → 1,235
;+---------------------------------+
;| DEFINITION BLOCKS |
;+---------------------------------+
 
t_block_0:
db 0,0,0,0
db 1,1,1,0
db 0,1,0,0
db 0,0,0,0
dd t_block_3
 
t_block_1:
db 0,1,0,0
db 1,1,0,0
db 0,1,0,0
db 0,0,0,0
dd t_block_0
 
t_block_2:
db 0,1,0,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd t_block_1
 
t_block_3:
db 0,1,0,0
db 0,1,1,0
db 0,1,0,0
db 0,0,0,0
dd t_block_2
 
;-----------------------------------
 
i_block_0:
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
dd i_block_1
 
i_block_1:
db 0,0,0,0
db 1,1,1,1
db 0,0,0,0
db 0,0,0,0
dd i_block_0
;-----------------------------------
 
q_block_0:
db 0,1,1,0
db 0,1,1,0
db 0,0,0,0
db 0,0,0,0
dd q_block_0
 
;-----------------------------------
 
s_block_0:
db 0,0,0,0
db 0,1,1,0
db 1,1,0,0
db 0,0,0,0
dd s_block_1
 
s_block_1:
db 1,0,0,0
db 1,1,0,0
db 0,1,0,0
db 0,0,0,0
dd s_block_0
 
;-----------------------------------
 
l_block_0:
db 0,0,0,0
db 1,1,1,0
db 1,0,0,0
db 0,0,0,0
dd l_block_3
 
l_block_1:
db 1,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,0,0,0
dd l_block_0
 
l_block_2:
db 0,0,1,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd l_block_1
 
l_block_3:
db 0,1,0,0
db 0,1,0,0
db 0,1,1,0
db 0,0,0,0
dd l_block_2
 
;-----------------------------------
 
g_block_0:
 
db 0,1,0,0
db 0,1,0,0
db 1,1,0,0
db 0,0,0,0
dd g_block_1
 
g_block_1:
db 0,0,0,0
db 1,1,1,0
db 0,0,1,0
db 0,0,0,0
dd g_block_2
 
g_block_2:
db 0,1,1,0
db 0,1,0,0
db 0,1,0,0
db 0,0,0,0
dd g_block_3
 
g_block_3:
db 1,0,0,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd g_block_0
 
;-----------------------------------
 
k_block_0:
db 0,0,0,0
db 1,1,0,0
db 0,1,1,0
db 0,0,0,0
dd k_block_1
 
k_block_1:
db 0,1,0,0
db 1,1,0,0
db 1,0,0,0
db 0,0,0,0
dd k_block_0
 
;-----------------------------------
;logo blocks
;-----------------------------------
 
tetris_t:
db 1,1,1,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
 
tetris_e:
db 1,1,1,0
db 1,0,0,0
db 1,1,0,0
db 1,0,0,0
db 1,1,1,0
 
tetris_r:
db 1,1,0,0
db 1,0,1,0
db 1,1,0,0
db 1,0,1,0
db 1,0,1,0
 
tetris_i:
db 0,1,0,0
db 0,0,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
 
tetris_s:
db 0,1,1,1
db 1,0,0,0
db 0,1,1,0
db 0,0,0,1
db 1,1,1,0
 
tetris_II:
db 1,1,1,1
db 0,1,1,0
db 0,1,1,0
db 0,1,1,0
db 1,1,1,1
 
;-----------------------------------
block_table:
dd t_block_0 ; t
dd t_block_1
dd t_block_2
dd t_block_3
dd i_block_0 ; i
dd i_block_1
dd i_block_0
dd i_block_1
dd q_block_0 ; q
dd q_block_0
dd q_block_0
dd q_block_0
dd s_block_0 ; s
dd s_block_1
dd s_block_0
dd s_block_1
dd l_block_0 ; l
dd l_block_1
dd l_block_2
dd l_block_3
dd g_block_0 ; g
dd g_block_1
dd g_block_2
dd g_block_3
dd k_block_0 ; k
dd k_block_1
dd k_block_0
dd k_block_1
 
color_table:
dd 00000000h ;black 0
dd 00cccccch ;white 1
dd 00cc0000h ;red 2
dd 0000cc00h ;green 3
dd 000000cch ;blue 4
dd 00cccc00h ;yellow 5
dd 0000cccch ;cyan 6
dd 00cc00cch ;pink 7
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tetris.asm tetris
@pause
/programs/tetris/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tetris.asm tetris
@pause
/programs/tetris/trunk/key.inc
0,0 → 1,161
UP_KEY equ 178 ; the ascii keycodes of some keys
DOWN_KEY equ 177
LEFT_KEY equ 176
RIGHT_KEY equ 179
ENTER_KEY equ 13
ESCAPE_KEY equ 27
 
key:
mov eax,2 ; Read key ascii and store it into ah
int 0x40
 
cmp ah,LEFT_KEY ; Check if left key is pressed
jne no_left
 
cmp byte[status],'1'
jne no_left
go_left:
dec dword [current_block_x]
call check_crash
jz no_left
inc dword [current_block_x]
 
no_left:
cmp ah,RIGHT_KEY ; Check if right key is pressed
jne no_right
 
cmp byte[status],'1'
jne no_right
go_right:
inc dword [current_block_x]
call check_crash
jz no_right
dec dword [current_block_x]
 
no_right:
cmp ah,UP_KEY ; Compare pressed key with up key
jne no_up ; Jump to nu_up if up key isnt pressed
 
cmp byte[status],'0' ; Check if menu is running
jne no_menu2 ; Jump to no_up ifgame isnt running
 
cmp byte[menu],'0' ; Compare menu state with 0
jne no_menu0 ; Jump to no_menu0 if menu state isnt zero
 
mov byte[menu],'3' ; Change menu state to 2
call draw_window ; Redraw the window
jmp no_menu2 ; Jump to no_menu2
 
no_menu0:
dec byte[menu] ; menu state = menu state - 1
call draw_window ; Redraw the window
 
no_menu2:
cmp byte[status],'1' ; Compare game state with 1
jne no_up ; Jump to no_up if game state isnt 1 (if game isnt running)
 
call rotate_block
 
no_up:
cmp ah,DOWN_KEY ; Check if down key is pressed
jne no_down
 
cmp byte[status],'0'
jne no_menu3
 
cmp byte[menu],'3'
jne no_menu1
 
mov byte[menu],'0'
call draw_window
jmp no_menu3
 
no_menu1:
inc byte[menu]
call draw_window
 
no_menu3:
cmp byte[status],'1'
jne no_down
 
inc dword [current_block_y]
call check_crash
jne block_crash
jmp still
 
 
no_down:
cmp ah,'n' ; Check if n key is pressed
jne no_n
jmp new_game
 
no_n:
cmp ah,'p' ; Check if p key is pressed
jne no_p
cmp byte[status],'2'
je unpause
cmp byte[status],'1' ; add this two line or p will work
jne no_p ; when your still in the menu
mov byte[status],'2'
call draw_window
jmp attesa
unpause:
mov byte[status],'1'
call draw_window
jmp still
 
no_p:
cmp byte[status],'0'
jne no_menu
 
no_menu:
cmp byte[status],'1'
jne no_game
 
no_game:
cmp byte[status],'2'
jne no_pause1
 
no_pause1:
cmp ah,ENTER_KEY ; Check if enter key is pressed
jne no_enter
cmp byte[status],'0'
jne no_enter
call exemenu
 
no_enter:
cmp ah,ESCAPE_KEY ; Check if escape key is pressed
jne no_escape
 
 
cmp byte[status],'0'
jne no_instr1
mov eax,-1
int 0x40
 
no_instr1:
cmp byte[status],'1'
jne no_menu4
mov byte[status],'0'
call draw_window
 
no_menu4:
cmp byte[status],'3'
jne no_menu5
mov byte[status],'0'
call draw_window
 
no_menu5:
cmp byte[status],'4'
jne no_escape
mov byte[status],'0'
call draw_window
 
no_escape:
 
cmp byte[status],'1'
jne still
jmp scendi
 
ret
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/menu.inc
0,0 → 1,137
draw_menu:
 
cmp byte[menu],'0'
jne menu1
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ffff00
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu1:
cmp byte[menu],'1'
jne menu2
 
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ffff00
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu2:
cmp byte[menu],'2'
jne menu3
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ffff00
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu3:
cmp byte[menu],'3'
jne menu4
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ffff00
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu4:
 
 
ret
 
exemenu:
cmp byte[menu],'0' ;start
jne exemenu1
call new_game
 
exemenu1:
cmp byte[menu],'1' ;instr
jne exemenu2
mov byte[status],'4'
call draw_window
 
exemenu2:
cmp byte[menu],'2' ;history
jne exemenu3
mov byte[status],'3'
call draw_window
 
exemenu3:
cmp byte[menu],'3' ;exit
jne exemenu4
mov eax,-1
int 0x40
 
exemenu4:
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/mouse.inc
0,0 → 1,87
mouse:
 
 
mov eax,37 ; get mouse position ; EXPERIMENTAL !!!
mov ebx,1 ; window relative ;
int 0x40 ; ;
shr eax,16 ; we only need to know the x position ;
sub eax,X_LOCATION ;
;
cmp eax,ADOBE_SIZE*(LEN_X-2) ; check to see if mouse is in field ;
jg no_mouse ; ;
cmp eax,0 ; ;
jl no_mouse ; ;
;
mov ebx,0 ;
;
mouseloop: ;
cmp eax,ADOBE_SIZE ;
jl yes_mouse ;
sub eax,ADOBE_SIZE ;
inc ebx ;
jmp mouseloop ;
;
yes_mouse: ;
cmp ebx,[current_block_x]
jg go_right
jl go_left
; mov dword[current_block_x],ebx ;
 
mov eax,37 ; get mouse position ;
mov ebx,2 ; buttons pressed (1=left, 2=right, 3=both) ;
int 0x40 ;
;
cmp eax,0 ;
jne yes_mouse_button ;
mov byte[lastmousebutton],0 ;
jmp no_mouse ;
yes_mouse_button: ;
;
cmp eax,2 ;
jne no_left_mouse ;
cmp byte[status],'1' ;
jne no_left_mouse ;
mov byte[lastmousebutton],2 ;
inc dword [current_block_y] ;
call check_crash ;
jne block_crash ;
jmp no_mouse ;
;
no_left_mouse: ;
;
;
cmp eax,1 ;
jne no_right_mouse ;
cmp byte[status],'1' ;
jne no_right_mouse ;
cmp byte[lastmousebutton],1 ;
mov byte[lastmousebutton],1 ;
je no_right_mouse ;
call rotate_block ;
call check_crash ;
jne block_crash ;
call draw_block ;
jmp scendi ;
;
no_right_mouse: ;
;
;
cmp eax,3 ;
jne no_mouse ;
cmp byte[lastmousebutton],3 ;
mov byte[lastmousebutton],3 ;
je no_mouse ;
cmp byte[status],'2' ;
je unpause ;
mov byte[status],'2' ;
call draw_window ;
jmp attesa ;
; unpause: ;
; mov byte[status],'1' ;
; call draw_window ;
; jmp still ;
;
; ;
no_mouse: ;
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/random.inc
0,0 → 1,18
;--------------------------------------------------------------
 
random: mov eax,[generator]
add eax,-43ab45b5h
ror eax,1
xor eax,32c4324fh
ror eax,1
mov [generator],eax
; --- IVAN ---
push ebx
mov eax,22
mov ebx,9
int 0x40
pop ebx
xor eax,0xdeadbeef
add eax,[generator]
; --- IVAN ---
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/score.inc
0,0 → 1,100
write_score:
 
mov eax,13
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-3)*65536+95 ;clear box to write new score
mov ecx,20*65536+((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-20)
mov edx,0x00000000
int 40h
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+25 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,scoretext
mov esi,linestext-scoretext
mov eax,4
int 0x40
 
mov eax,[score]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+25 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+35 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,linestext
mov esi,speedtext-linestext
mov eax,4
int 0x40
 
mov eax,[lines]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+35 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+45 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,speedtext
mov esi,leveltext-speedtext
mov eax,4
int 0x40
 
mov eax,[speed]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+45 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+55 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,leveltext
mov esi,startgame-leveltext
mov eax,4
int 0x40
 
mov eax,[level]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+55 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
call draw_next_block
 
ret
 
 
number_to_str:
 
mov edi,end_number_str-1
mov ecx,9;size_of_number_str
mov ebx,10
cld
new_digit:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_digit
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/table.inc
0,0 → 1,56
;--------------------------------------------------------------
; DRAW_TABLE
;--------------------------------------------------------------
draw_table: mov esi,table_tetris+LEN_X*BORDER_TOP+BORDER_LEFT
 
mov ebx,X_LOCATION*65536+ADOBE_SIZE
mov ecx,Y_LOCATION*65536+ADOBE_SIZE
mov edi,LEN_Y-BORDER_TOP-BORDER_BOTTOM
y_draw: push edi
 
mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT
x_draw: push edi
mov ax,13
movzx edx,byte [esi]
mov edx,[color_table+edx*4]
int 0x40
call draw_frames
inc esi
add ebx,65536*ADOBE_SIZE
pop edi
dec edi
jnz x_draw
 
add esi,BORDER_LEFT+BORDER_RIGHT
mov ebx,X_LOCATION*65536+ADOBE_SIZE
add ecx,65536*ADOBE_SIZE
pop edi
dec edi
jnz y_draw
 
ret
 
;--------------------------------------------------------------
 
clear_table_tetris:
cld
mov al,1
mov edi,table_tetris
mov ecx,LEN_X*BORDER_TOP
rep stosb
 
mov edx,LEN_Y-BORDER_TOP-BORDER_BOTTOM
adr300: mov cl,BORDER_LEFT
rep stosb
dec ax ;AL=0
mov cl,LEN_X-BORDER_LEFT-BORDER_RIGHT
rep stosb
inc ax ;AL=1
mov cl,BORDER_RIGHT
rep stosb
dec dx
jne adr300
 
mov ecx,LEN_X*BORDER_BOTTOM
rep stosb
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/tetris.asm
0,0 → 1,253
; Date : 1st April 2001
; TETRIS for MENUET
; Author : Paolo Minazzi (email paolo.minazzi@inwind.it)
;
; -Note-
; 1. This program requires a PENTIUM or higher because uses the RDTSC
; instrucion for get a random number.
; 2. You must use NASM to compile. Compiling is OK with NASM 0.98, I
; don't know what happen with other versions.
; 3. You must use the arrow key to move and rotate a block.
; 4. In the near future there will be a new version of TETRIS. This is
; only the beginning.
;
; Thanks to Ville, the author of this wonderful OS !
; Join with us to code !
;
;
; Changelog:
;
; 28.06.2001 - fasm port & framed blocks - Ville Turjanmaa
; 31.10.2001 - rdtsc replaced - quickcode <quickcode@mail.ru>
; 03.11.2003 - added new blocks & random - Ivan Poddubny
;
 
LEN_X equ 14
LEN_Y equ 24
BORDER_LEFT equ 2
BORDER_RIGHT equ 2
BORDER_TOP equ 1
BORDER_BOTTOM equ 1
ADOBE_SIZE equ 12
X_LOCATION equ 6
Y_LOCATION equ 21
_MAXBLOCKS_ = 7*4
SCORE_TO_NEW_LEVEL equ 100000
 
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; program start
dd I_END ; program image size
dd IM_END ; reguired amount of memory
dd IM_END ; esp
dd 0x0,0x0 ; I_PARAM, I_ICON
include 'lang.inc'
START: ; start of execution
 
mov eax,3 ;
int 0x40 ;
mov cl,16 ;
ror eax,cl ; to make seconds more significant
mov [generator],eax ;
call random ;
 
mov byte[status],'0'
mov byte[menu],'0'
call draw_window ; at first, draw the window
 
still:
 
cmp byte[status],'2'
je attesa
 
cmp byte[status],'1'
 
jne attesa
xor edx,edx
 
call draw_block
 
 
attesa:
 
call mouse
;disabled because of bug
;EDIT: the bug is somewhere else..
;NOTE: dont release this without fixing the bug you lazy bastard!
 
mov eax,11 ; get event
int 0x40
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jnz check_button
jmp key
check_button:
cmp eax,3 ; button in buffer ?
jnz scendi
mov eax,-1 ; close this program
int 0x40
 
red: ; redraw
call draw_window
jmp still
 
parallel dd 1
 
scendi: cmp byte[status],'1'
jne still
 
cmp byte[blabla],10
je blabla_0
inc byte[blabla]
jmp blabla_1
blabla_0:
mov byte[blabla],0
inc dword [current_block_y]
call check_crash
jne block_crash
blabla_1:
 
 
draw: movzx edx,byte [current_block_color]
call draw_block
mov eax,5
mov ebx,5
sub ebx,[speed]
int 0x40
jmp still
 
block_crash: dec dword [current_block_y]
movzx edx,byte [current_block_color]
call draw_block
call fix_block
call check_full_line
call draw_table
call new_block
call write_score
call check_crash
jz adr400
aspetta: mov eax,10
int 0x40
cmp eax,1
jne adr10000
call draw_window
adr10000: cmp eax,3
jne aspetta
 
new_game: mov dword [score],0
mov dword [lines],0
mov dword [level],0
mov dword [speed],0
mov byte [status],'1'
call clear_table_tetris
call first_block
call new_block
call draw_window
 
adr400: movzx edx,byte [current_block_color]
call draw_block
jmp still
 
include 'key.inc'
include 'mouse.inc'
include 'menu.inc'
include 'window.inc'
include 'block.inc'
include 'table.inc'
include 'random.inc'
include 'score.inc'
 
; DATA AREA
 
include 'blocks.inc'
 
labelt: db 'TETRIS II'
scoretext: db 'Score:'
linestext: db 'Lines:'
speedtext: db 'Speed:'
leveltext: db 'Level:'
startgame: db 'START'
instr: db 'INSTRUCTIONS'
hist: db 'HISTORY'
quit: db 'EXIT'
paused: db 'PAUSED'
txt_end:
 
history:
db 'TETRIS for MENUET v2.0 '
db ' '
db ' '
db 'Originally made '
db ' by Paolo Minazzi '
db ' '
db 'Port & framed blocks '
db ' by Ville Turjanmaa '
db ' '
db 'RDTSC replaced '
db ' by quickcode '
db ' '
db 'New blocks & better random '
db ' by Ivan Poddubny '
db ' '
db 'Better control, logo, menu, pause '
db ' by Jeffrey Amelynck'
 
db 'x <- END MARKER, DONT DELETE '
 
instructions:
db 'TETRIS for MENUET v2.0 '
db ' '
db 'Controls: '
db ' '
db 'Use left & right key to navigate '
db 'Use up key to turn the block '
db 'Use down key to make block fall '
db 'Use P to pause game '
db 'Use N to start a new game '
db 'Use ESC to go back to menu or exit'
db 'You can also use the mouse to move'
db 'the blocks, left button to let the'
db 'blocks fall and right button to '
db 'rotate them '
db 'you can pause the game by pressing'
db 'both mouse buttons '
db ' '
db 'DONT FORGET: move mouse out of the'
db 'window if you want to use keyboard'
 
db 'x <- END MARKER, DONT DELETE '
 
I_END:
 
score: dd 0
level: dd 0
speed: dd 0
lines: dd 0
TMP_0: dd 0
TMP_1: dd 0
generator: dd 0
current_block_x: dd 0
current_block_y: dd 0
current_block_pointer: dd 0
current_block_color: db 0
next_block_pointer: dd 0
next_block_color: db 0
blabla dd 0
lastmousebutton dd 0
number_str: db 0,0,0,0,0,0,0,0,0
end_number_str:
size_of_number_str dd 7
delay: dd 5
status: dd 0 ; 0=menu, 1=playing, 2=paused, 3=history , 4=instructions
menu: dd 0 ; 0=start, 1=instructions, 2=history, 3=exit
 
table_tetris: rb 2048+55
 
IM_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tetris/trunk/window.inc
0,0 → 1,142
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,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98
mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+4
mov edx,0x03000000 ; color of work area RRGGBB
mov esi,0x006688ee ; color of grab bar RRGGBB,8->col
mov edi,0x007799ff ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+5 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,scoretext-labelt ; text length
int 0x40
 
cmp byte[status],'0'
jne status1
call draw_logo
call draw_menu
 
status1:
cmp byte[status],'1'
jne status2
 
call draw_game
 
status2:
cmp byte[status],'2'
jne status3
 
call draw_game
 
mov eax,4 ; function 4 : write text to window
mov ebx,80*65536+170 ; [x start] *65536 + [y start]
mov ecx,0x10ff0000 ; color of text RRGGBB
mov edx,paused ; pointer to text beginning
mov esi,txt_end-paused ; text length
int 0x40
 
status3:
cmp byte[status],'3'
jne status4
 
call draw_logo
mov edx,history
call show_text
 
status4:
cmp byte[status],'4'
jne status5
 
call draw_logo
mov edx,instructions
call show_text
 
status5:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
draw_game:
 
call draw_table
movzx edx,byte [current_block_color]
call draw_block
 
call write_score
 
mov eax,38
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4) shl 16 + ((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4)
mov ecx,20 shl 16 + ((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+2-4)
mov edx,0x00ffffff
int 0x40
 
ret
 
draw_logo:
 
mov ebx,2
mov ecx,2
mov edx,[color_table+1*4]
mov edi,tetris_t
call draw_title_block
mov ebx,5
mov ecx,3
mov edx,[color_table+2*4]
mov edi,tetris_e
call draw_title_block
mov ebx,8
mov ecx,2
mov edx,[color_table+3*4]
mov edi,tetris_t
call draw_title_block
mov ebx,11
mov ecx,3
mov edx,[color_table+4*4]
mov edi,tetris_r
call draw_title_block
mov ebx,13
mov ecx,2
mov edx,[color_table+5*4]
mov edi,tetris_i
call draw_title_block
mov ebx,15
mov ecx,3
mov edx,[color_table+6*4]
mov edi,tetris_s
call draw_title_block
mov ebx,20
mov ecx,2
mov edx,[color_table+7*4]
mov edi,tetris_II
call draw_title_block
 
ret
 
show_text:
mov ebx,6*65536+120 ; draw info text with function 4
mov ecx,0xff0000
mov esi,34
newline:
mov eax,4
int 0x40
add ebx,10
add edx,34
cmp [edx],byte 'x'
jne newline
ret
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tftpa/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tftpa.asm tftpa
@pause
/programs/tftpa/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tftpa.asm tftpa
@pause
/programs/tftpa/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tftpa/trunk/tftpa.asm
0,0 → 1,755
;
; TFTP Wave Player
;
; Compile with FASM for Menuet
;
;
; 12.7.2002 - Audio system calls by VT
;
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'
delay dd 145
wait_for dd 0x0
START: ; start of execution
mov dword [prompt], p9
mov dword [promptlen], p9len - p9
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 [socketNum], dword 0
mov eax,0xffffffff ; close this program
int 0x40
noclose:
cmp ah,2 ; copy file to local machine?
jnz nocopyl
mov dword [prompt], p5
mov dword [promptlen], p5len - p5
call draw_window ;
; Copy File from Remote Host to this machine
call translateData ; Convert Filename & IP address
mov edi, tftp_filename + 1
mov [edi], byte 0x01 ; setup tftp msg
call copyFromRemote
jmp still
nocopyl:
cmp ah,4
jz f1
cmp ah,5
jz f2
jmp nof12
f1:
mov [addr],dword source
mov [ya],dword 35
jmp rk
f2:
mov [addr],dword destination
mov [ya],dword 35+16
rk:
mov ecx,15
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,15
cmp esi,edi
jnz f11
jmp still
print_text:
mov eax,13
mov ebx,103*65536+15*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,15
int 0x40
ret
nof12:
jmp still
;***************************************************************************
; Function
; translateData
;
; Description
; Coverts the filename and IP address typed in by the user into
; a format suitable for the IP layer.
;
; The filename, in source, is converted and stored in tftp_filename
; The host ip, in destination, is converted and stored in tftp_IP
;
;***************************************************************************
translateData:
; first, build up the tftp command string. This includes the filename
; and the transfer protocol
; First, write 0,0
mov al, 0
mov edi, tftp_filename
mov [edi], al
inc edi
mov [edi], al
inc edi
; Now, write the file name itself, and null terminate it
mov ecx, 15
mov ah, ' '
mov esi, source
td001:
lodsb
stosb
cmp al, ah
loopnz td001
cmp al,ah ; Was the entire buffer full of characters?
jne td002
dec edi ; No - so remove ' ' character
td002:
mov [edi], byte 0
inc edi
mov [edi], byte 'O'
inc edi
mov [edi], byte 'C'
inc edi
mov [edi], byte 'T'
inc edi
mov [edi], byte 'E'
inc edi
mov [edi], byte 'T'
inc edi
mov [edi], byte 0
mov esi, tftp_filename
sub edi, esi
mov [tftp_len], edi
; Now, convert the typed IP address into a real address
; No validation is done on the number entered
; ip addresses must be typed in normally, eg
; 192.1.45.24
xor eax, eax
mov dh, 10
mov dl, al
mov [tftp_IP], eax
; 192.168.24.1 1.1.1.1 1. 9.2.3.
mov esi, destination
mov edi, tftp_IP
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
ret
;***************************************************************************
; Function
; copyFromRemote
;
; Description
;
;***************************************************************************
copyFromRemote:
mov eax,0x20000-512
mov [fileposition], eax
; Get a random # for the local socket port #
mov eax, 3
int 0x40
mov ecx, eax
shr ecx, 8 ; Set up the local port # with a random #
; open socket
mov eax, 53
mov ebx, 0
mov edx, 69 ; remote port
mov esi, [tftp_IP] ; remote IP ( in intenet format )
int 0x40
mov [socketNum], eax
; make sure there is no data in the socket - there shouldn't be..
cfr001:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne cfr001 ; yes, so get it
; Now, request the file
mov eax, 53
mov ebx, 4
mov ecx, [socketNum]
mov edx, [tftp_len]
mov esi, tftp_filename
int 0x40
cfr002:
mov eax,23 ; wait here for event
mov ebx,1 ; Time out after 10ms
int 0x40
cmp eax,1 ; redraw request ?
je cfr003
cmp eax,2 ; key in buffer ?
je cfr004
cmp eax,3 ; button in buffer ?
je cfr005
; Any data to fetch?
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40
cmp eax, 0
je cfr002
push eax ; eax holds # chars
; Update the text on the display - once
mov eax, [prompt]
cmp eax, p3
je cfr008
mov dword [prompt], p3
mov dword [promptlen], p3len - p3
call draw_window ;
cfr008:
; we have data - this will be a tftp frame
; read first two bytes - opcode
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
pop eax
; bl holds tftp opcode. Can only be 3 (data) or 5 ( error )
cmp bl, 3
jne cfrerr
push eax
; do data stuff. Read block #. Read data. Send Ack.
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov [blockNumber], bl
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov [blockNumber+1], bl
cfr007:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov esi, [fileposition]
mov [esi], bl
mov [esi+1],bl
add dword [fileposition],2
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne cfr007 ; yes, so get it
cmp [fileposition],0x20000+0xffff
jb get_more_stream
wait_more:
mov eax,5 ; wait for correct timer position
; to trigger new play block
mov ebx,1
int 0x40
mov eax,26
mov ebx,9
int 0x40
cmp eax,[wait_for]
jb wait_more
add eax,[delay]
mov [wait_for],eax
mov esi,0x20000
mov edi,0x10000
mov ecx,65536
cld
rep movsb
mov eax,55
mov ebx,0
mov ecx,0x10000
int 0x40
mov eax,55
mov ebx,1
int 0x40
mov [fileposition],0x20000
get_more_stream:
; write the block number into the ack
mov al, [blockNumber]
mov [ack + 2], al
mov al, [blockNumber+1]
mov [ack + 3], al
; send an 'ack'
mov eax, 53
mov ebx, 4
mov ecx, [socketNum]
mov edx, ackLen - ack
mov esi, ack
int 0x40
; If # of chars in the frame is less that 516,
; this frame is the last
pop eax
cmp eax, 516
je cfr002
; Write the file
mov eax, 33
mov ebx, source
mov edx, [filesize]
mov ecx, I_END + 512
mov esi, 0
int 0x40
jmp cfrexit
cfrerr:
; simple implementation on error - just read all data, and return
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne cfrerr ; yes, so get it
jmp cfr006 ; close socket and close app
cfr003: ; redraw request
call draw_window
jmp cfr002
cfr004: ; key pressed
mov eax,2 ; just read it and ignore
int 0x40
jmp cfr002
cfr005: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne cfr002 ; If not, ignore.
cfr006:
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov [socketNum], dword 0
mov eax,-1 ; close this program
int 0x40
jmp $
cfrexit:
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov [socketNum], dword 0
mov dword [prompt], p4
mov dword [promptlen], p4len - p4
call draw_window ;
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+170 ; [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 ; COPY BUTTON
mov ebx,20*65536+190
mov ecx,79*65536+15
mov edx,3
mov esi,0x557799
; int 0x40
mov eax,8 ; DELETE BUTTON
mov ebx,20*65536+190
mov ecx,111*65536+15
mov edx,2
mov esi,0x557799
int 0x40
mov eax,8
mov ebx,200*65536+10
mov ecx,34*65536+10
mov edx,4
mov esi,0x557799
int 0x40
mov eax,8
mov ebx,200*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,source
mov edi,text+13
mov ecx,15
rep movsb
; copy the IP address to the screen buffer
mov esi,destination
mov edi,text+40+13
mov ecx,15
rep movsb
; copy the prompt to the screen buffer
mov esi,[prompt]
mov edi,text+280
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
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
; DATA AREA
source db 'HEAT8M22.WAV '
destination db '192.168.1.24 '
tftp_filename: times 15 + 9 db 0
tftp_IP: dd 0
tftp_len: dd 0
addr dd 0x0
ya dd 0x0
fileposition dd 0 ; Points to the current point in the file
filesize dd 0 ; The number of bytes written / left to write
fileblocksize dw 0 ; The number of bytes to send in this frame
text:
db 'SOURCE FILE: xxxxxxxxxxxxxxx '
db 'HOST IP ADD: xxx.xxx.xxx.xxx '
db ' '
db 'WAVE FORMAT: 8 BIT,MONO,22050HZ '
db ' '
db ' SERVER -> PLAY FILE '
db ' '
db ' '
db 'x <- END MARKER, DONT DELETE '
labelt:
db 'TFTP Wave Player'
labellen:
prompt: dd 0
promptlen: dd 0
p1: db 'Waiting for Command '
p1len:
p9: db 'Define SB with setup'
p9len:
p2: db 'Sending File '
p2len:
p3: db 'Playing File '
p3len:
p4: db 'Complete '
p4len:
p5: db 'Contacting Host... '
p5len:
p6: db 'File not found. '
p6len:
ack:
db 00,04,0,1
ackLen:
socketNum:
dd 0
blockNumber:
dw 0
; This must be the last part of the file, because the blockBuffer
; continues at I_END.
blockBuffer:
db 00, 03, 00, 01
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tftpc/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tftpc.asm tftpc
@pause
/programs/tftpc/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tftpc.asm tftpc
@pause
/programs/tftpc/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tftpc/trunk/tftpc.asm
0,0 → 1,986
;
; TFTP Client
;
; 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
mov eax,40 ; Report events
mov ebx,10000111b ; Stack 8 + defaults
int 0x40
mov dword [prompt], p1
mov dword [promptlen], p1len - p1
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 [socketNum], dword 0
mov eax,0xffffffff ; close this program
int 0x40
noclose:
cmp ah,2 ; copy file to local machine?
jnz nocopyl
mov dword [prompt], p5
mov dword [promptlen], p5len - p5
call draw_window ;
; Copy File from Remote Host to this machine
call translateData ; Convert Filename & IP address
mov edi, tftp_filename + 1
mov [edi], byte 0x01 ; setup tftp msg
call copyFromRemote
jmp still
nocopyl:
cmp ah,3 ; Copy file to host?
jnz nocopyh
mov dword [prompt], p5
mov dword [promptlen], p5len - p5
call draw_window ;
; Copy File from this machine to Remote Host
call translateData ; Convert Filename & IP address
mov edi, tftp_filename + 1
mov [edi], byte 0x02 ; setup tftp msg
call copyToRemote
jmp still
nocopyh:
cmp ah,4
jz f1
cmp ah,5
jz f2
jmp nof12
f1:
mov [addr],dword source
mov [ya],dword 35
jmp rk
f2:
mov [addr],dword destination
mov [ya],dword 35+16
rk:
mov ecx,15
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,15
cmp esi,edi
jnz f11
jmp still
print_text:
mov eax,13
mov ebx,103*65536+15*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,15
int 0x40
ret
nof12:
jmp still
;***************************************************************************
; Function
; translateData
;
; Description
; Coverts the filename and IP address typed in by the user into
; a format suitable for the IP layer.
;
; The filename, in source, is converted and stored in tftp_filename
; The host ip, in destination, is converted and stored in tftp_IP
;
;***************************************************************************
translateData:
; first, build up the tftp command string. This includes the filename
; and the transfer protocol
; First, write 0,0
mov al, 0
mov edi, tftp_filename
mov [edi], al
inc edi
mov [edi], al
inc edi
; Now, write the file name itself, and null terminate it
mov ecx, 15
mov ah, ' '
mov esi, source
td001:
lodsb
stosb
cmp al, ah
loopnz td001
cmp al,ah ; Was the entire buffer full of characters?
jne td002
dec edi ; No - so remove ' ' character
td002:
mov [edi], byte 0
inc edi
mov [edi], byte 'O'
inc edi
mov [edi], byte 'C'
inc edi
mov [edi], byte 'T'
inc edi
mov [edi], byte 'E'
inc edi
mov [edi], byte 'T'
inc edi
mov [edi], byte 0
mov esi, tftp_filename
sub edi, esi
mov [tftp_len], edi
; Now, convert the typed IP address into a real address
; No validation is done on the number entered
; ip addresses must be typed in normally, eg
; 192.1.45.24
xor eax, eax
mov dh, 10
mov dl, al
mov [tftp_IP], eax
; 192.168.24.1 1.1.1.1 1. 9.2.3.
mov esi, destination
mov edi, tftp_IP
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
ret
;***************************************************************************
; Function
; copyFromRemote
;
; Description
;
;***************************************************************************
copyFromRemote:
xor eax, eax
mov [filesize], eax
mov eax, I_END + 512 ; This is the point where the file buffer is
mov [fileposition], eax
; Get a random # for the local socket port #
mov eax, 3
int 0x40
mov ecx, eax
shr ecx, 8 ; Set up the local port # with a random #
; open socket
mov eax, 53
mov ebx, 0
mov edx, 69 ; remote port
mov esi, [tftp_IP] ; remote IP ( in intenet format )
int 0x40
mov [socketNum], eax
; make sure there is no data in the socket - there shouldn't be..
cfr001:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne cfr001 ; yes, so get it
; Now, request the file
mov eax, 53
mov ebx, 4
mov ecx, [socketNum]
mov edx, [tftp_len]
mov esi, tftp_filename
int 0x40
cfr002:
mov eax,10 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
je cfr003
cmp eax,2 ; key in buffer ?
je cfr004
cmp eax,3 ; button in buffer ?
je cfr005
; Any data to fetch?
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40
cmp eax, 0
je cfr002
push eax ; eax holds # chars
; Update the text on the display - once
mov eax, [prompt]
cmp eax, p3
je cfr008
mov dword [prompt], p3
mov dword [promptlen], p3len - p3
call draw_window ;
cfr008:
; we have data - this will be a tftp frame
; read first two bytes - opcode
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
pop eax
; bl holds tftp opcode. Can only be 3 (data) or 5 ( error )
cmp bl, 3
jne cfrerr
push eax
; do data stuff. Read block #. Read data. Send Ack.
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov [blockNumber], bl
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov [blockNumber+1], bl
cfr007:
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
je no_more_data ; no
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov esi, [fileposition]
mov [esi], bl
inc dword [fileposition]
inc dword [filesize]
jmp cfr007
no_more_data:
; write the block number into the ack
mov al, [blockNumber]
mov [ack + 2], al
mov al, [blockNumber+1]
mov [ack + 3], al
; send an 'ack'
mov eax, 53
mov ebx, 4
mov ecx, [socketNum]
mov edx, ackLen - ack
mov esi, ack
int 0x40
; If # of chars in the frame is less that 516,
; this frame is the last
pop eax
cmp eax, 516
je cfr002
; Write the file
mov eax, 33
mov ebx, source
mov edx, [filesize]
mov ecx, I_END + 512
mov esi, 0
int 0x40
jmp cfrexit
cfrerr:
; simple implementation on error - just read all data, and return
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne cfrerr ; yes, so get it
jmp cfr006 ; close socket and close app
cfr003: ; redraw request
call draw_window
jmp cfr002
cfr004: ; key pressed
mov eax,2 ; just read it and ignore
int 0x40
jmp cfr002
cfr005: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne cfr002 ; If not, ignore.
cfr006:
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov [socketNum], dword 0
mov eax,-1 ; close this program
int 0x40
jmp $
cfrexit:
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov [socketNum], dword 0
mov dword [prompt], p4
mov dword [promptlen], p4len - p4
call draw_window ;
ret
;***************************************************************************
; Function
; copyToRemote
;
; Description
;
;***************************************************************************
copyToRemote:
mov eax,6 ; Read file from floppy (image)
mov ebx,source
mov ecx,0
mov edx,0xffffffff
mov esi,I_END + 512
int 0x40
cmp eax,0xffffffff
jnz filefound
mov dword [prompt], p6
mov dword [promptlen], p6len - p6
call draw_window ;
jmp ctr_exit
filefound:
mov [filesize], eax
; First, set up the file pointers
mov eax, 0x01000300
mov [blockBuffer], eax ; This makes sure our TFTP header is valid
mov eax, I_END + 512 ; This is the point where the file buffer is
mov [fileposition], eax
mov eax, [filesize]
cmp eax, 512
jb ctr000
mov eax, 512
ctr000:
mov [fileblocksize], ax
; Get a random # for the local socket port #
mov eax, 3
int 0x40
mov ecx, eax
shr ecx, 8 ; Set up the local port # with a random #
; First, open socket
mov eax, 53
mov ebx, 0
mov edx, 69 ; remote port
mov esi, [tftp_IP]
int 0x40
mov [socketNum], eax
; write to socket ( request write file )
mov eax, 53
mov ebx, 4
mov ecx, [socketNum]
mov edx, [tftp_len]
mov esi, tftp_filename
int 0x40
; 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
; Update the text on the display - once
mov eax, [prompt]
cmp eax, p2
je ctr002
mov dword [prompt], p2
mov dword [promptlen], p2len - p2
call draw_window ;
; we have data - this will be the ack
ctr002:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - opcode
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - opcode
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - block (high byte)
mov [blockNumber], bl
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - block (low byte )
mov [blockNumber+1], bl
ctr0022:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte (shouldn't have worked)
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne ctr0022 ; yes, so get it, and dump it
; If the ack is 0, it is to the request
mov bx, [blockNumber]
cmp bx, 0
je txd
; now, the ack should be one more than the current field - otherwise, resend
cmp bx, [blockBuffer+2]
jne txre ; not the same, so send again
; update the block number
mov esi, blockBuffer + 3
mov al, [esi]
inc al
mov [esi], al
cmp al, 0
jne ctr008
dec esi
inc byte [esi]
ctr008:
; Move forward through the file
mov eax, [fileposition]
movzx ebx, word [fileblocksize]
add eax, ebx
mov [fileposition], eax
; new ..
; fs = 0 , fbs = 512 -> send with fbs = 0
cmp [filesize],0
jne no_special_end
cmp [fileblocksize],512
jne no_special_end
mov ax,0
jmp ctr006
no_special_end:
mov eax, [filesize]
cmp eax, 0
je ctr009
cmp eax, 512
jb ctr006
mov eax, 512
ctr006:
mov [fileblocksize], ax
txd:
; Readjust the file size variable ( before sending )
mov eax, [filesize]
movzx ebx, word [fileblocksize]
sub eax, ebx
mov [filesize], eax
txre:
; Copy the fragment of the file to the block buffer
movzx ecx, word [fileblocksize]
mov esi, [fileposition]
mov edi, I_END
cld
rep movsb
; send the file data
mov eax, 53
mov ebx, 4
mov ecx, [socketNum]
movzx edx, word [fileblocksize]
add edx, 4
mov esi, blockBuffer
int 0x40
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
cmp ah,1 ; button id=1 ?
jne ctr001
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov [socketNum], dword 0
mov eax,-1 ; close this program
int 0x40
jmp $
ctr009:
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov dword [prompt], p4
mov dword [promptlen], p4len - p4
call draw_window ;
ctr_exit:
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+170 ; [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 ; COPY BUTTON
mov ebx,20*65536+190
mov ecx,79*65536+15
mov edx,2
mov esi,0x557799
int 0x40
mov eax,8 ; DELETE BUTTON
mov ebx,20*65536+190
mov ecx,111*65536+15
mov edx,3
mov esi,0x557799
int 0x40
mov eax,8
mov ebx,200*65536+10
mov ecx,34*65536+10
mov edx,4
mov esi,0x557799
int 0x40
mov eax,8
mov ebx,200*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,source
mov edi,text+13
mov ecx,15
rep movsb
; copy the IP address to the screen buffer
mov esi,destination
mov edi,text+40+13
mov ecx,15
rep movsb
; copy the prompt to the screen buffer
mov esi,[prompt]
mov edi,text+280
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
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
; DATA AREA
source db 'KERNEL.ASM '
destination db '192.168.1.23 '
tftp_filename: times 15 + 9 db 0
tftp_IP: dd 0
tftp_len: dd 0
addr dd 0x0
ya dd 0x0
fileposition dd 0 ; Points to the current point in the file
filesize dd 0 ; The number of bytes written / left to write
fileblocksize dw 0 ; The number of bytes to send in this frame
text:
db 'SOURCE FILE: xxxxxxxxxxxxxxx '
db 'HOST IP ADD: xxx.xxx.xxx.xxx '
db ' '
db ' COPY HOST -> LOCAL '
db ' '
db ' COPY LOCAL -> HOST '
db ' '
db ' '
db 'x <- END MARKER, DONT DELETE '
labelt:
db 'TFTP Client'
labellen:
prompt: dd 0
promptlen: dd 0
p1: db 'Waiting for Command'
p1len:
p2: db 'Sending File '
p2len:
p3: db 'Receiving File '
p3len:
p4: db 'Tranfer Complete '
p4len:
p5: db 'Contacting Host... '
p5len:
p6: db 'File not found. '
p6len:
ack:
db 00,04,0,1
ackLen:
socketNum:
dd 0
blockNumber:
dw 0
; This must be the last part of the file, because the blockBuffer
; continues at I_END.
blockBuffer:
db 00, 03, 00, 01
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/thread/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm thread.asm thread
@pause
/programs/thread/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm thread.asm thread
@pause
/programs/thread/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/thread/trunk/thread.asm
0,0 → 1,175
;
; THREAD 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 0x2000 ; 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 ; 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 (thread)
int 0x40
noclose:
 
cmp ah,2
jne no_thread
 
cmp [thread_stack],0x1f00
jge no_thread
 
add [thread_stack],0x100
mov eax,51
mov ebx,1
mov ecx,START
mov edx,[thread_stack]
int 0x40
 
jmp still
 
no_thread:
 
jmp still
 
thread_stack dd 0x1000
 
 
; *********************************************
; ******* 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,10*65536+290 ; [x start] *65536 + [x size]
mov ecx,10*65536+130 ; [y start] *65536 + [y size]
mov esi,[thread_stack]
sub esi,0x1000
shr esi,4
shl esi,16
add ebx,esi
add ecx,esi
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 ; NEW THREAD BUTTON
mov ebx,25*65536+128
mov ecx,88*65536+20
mov edx,2
mov esi,0x90b0d0 ;0x5577cc
int 0x40
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0x224466
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
 
if lang eq ru
text:
db '’€ Žƒ€ŒŒ€ ‘Ž‡„€…’ Ž’ŽŠˆ, ‡€“‘Š€Ÿ '
db 'Ž„ˆ ˆ ’Ž’ †… ŠŽ„ ŒŽƒŽ €‡. €Œ “†Ž '
db '’Ž‹œŠŽ Ž‡€Ž’ˆ’œ‘Ÿ Ž Ž’„…‹œŽŒ ‘’Š… '
db '„‹Ÿ Š€†„ŽƒŽ Ž’ŽŠ€. '
db '€ŒŸ’œ „‹Ÿ ‚‘…• Ž’ŽŠŽ‚ Ž™€Ÿ. '
db ' '
db ' ‘Ž‡„€’œ Ž‚›‰ Ž’ŽŠ '
 
db 'x' ; <- END MARKER, DONT DELETE
 
labelt:
db 'ˆŒ… ˆ‘Ž‹œ‡Ž‚€ˆŸ 51®© ”“Š–ˆˆ'
labellen:
else
text:
db 'THIS EXAMPLE CREATES THREADS BY RUNNING '
db 'THE SAME CODE MULTIPLE TIMES. ALL WE '
db 'NEED IS A NEW STACK FOR EACH THREAD. '
db 'ALL THREADS SHARE THE SAME MEMORY. '
db ' '
db ' '
db ' CREATE NEW THREAD '
 
db 'x' ; <- END MARKER, DONT DELETE
 
labelt:
db 'THREAD EXAMPLE'
labellen:
end if
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/timer/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm timer.asm timer
@pause
/programs/timer/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm timer.asm timer
@pause
/programs/timer/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/timer/trunk/timer.asm
0,0 → 1,176
;
; TIMER
;
; Compile with flat assembler
;
 
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
mov eax, 40
mov ebx, 101b
int 0x40
 
red:
call draw_window
 
still:
 
mov eax,23 ; wait here for event
mov ebx,50
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,3 ; button in buffer ?
je button
 
call draw_clock
 
jmp still
 
 
button: ; button
or eax,-1 ; close this program
int 0x40
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
draw_clock:
mov eax, 13 ; clear area
mov ebx, 10*65536+55
mov ecx, 30*65536+10
mov edx, [sc.work]
int 0x40
 
mov eax, 26 ; get system counter
mov ebx, 9
int 0x40
 
cdq ;xor edx,edx
mov ebx,100
div ebx
 
push eax
 
xor edx,edx
mov ebx,60
div ebx
mov ecx,eax
 
push ecx
push ecx
 
xor edx,edx
mov ebx,60
div ebx
mov ecx,eax
 
mov eax,47 ; HH
mov esi,[sc.work_text]
or esi,0x10000000
mov ebx,0x00020000
mov edx,10*65536+30
int 0x40
 
pop eax ; MM
imul ecx,ecx,60
sub eax,ecx
mov ecx,eax
mov eax,47
add edx,20*65536
int 0x40
 
pop ecx
pop eax
 
imul ecx,ecx,60
sub eax,ecx
 
mov ecx,eax ; SS
mov eax,47
add edx,20*65536
int 0x40
 
ret
 
draw_window:
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+75 ; [x start] *65536 + [x size]
mov ecx,100*65536+45 ; [y start] *65536 + [y size]
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
mov esi,[sc.grab] ; color of grab bar RRGGBB,8->color gl
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,6*65536+7 ; [x start] *65536 + [y start]
mov ecx,[sc.grab_text] ; font 1 & color ( 0xF0RRGGBB )
or ecx,0x10000000
mov edx,header ; pointer to text beginning
mov esi,header.len ; text length
int 0x40
 
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(75-16)*65536+12 ; [x start] *65536 + [x size]
mov ecx,4*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,[sc.grab_button] ; button color RRGGBB
int 0x40
 
call draw_clock
 
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 'TIMER'
.len = $ - header
end if
 
 
I_END:
 
temp dd ?
sc system_colors
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinyfrac/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tinyfrac.asm tinyfrac
@pause
/programs/tinyfrac/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tinyfrac.asm tinyfrac
@pause
/programs/tinyfrac/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinyfrac/trunk/tinyfrac.asm
0,0 → 1,519
; tinyfrac.asm
;
; teeny program displays the Mandelbrot set.
;
; written on Sun 03-26-1995 by Ed Beroset (Fidonet 1:3641/1.250)
;
; This program was based on a program by Frank Hommers, later optimized
; for size by Mikko Hyvarinen and posted in Fidonet's 80XXX echo.
;
; This new version has many new features and was based on my own
; optimization of Hyvarinen's version. Some features:
;
; pan using the arrow keys, one can navigate the fractal.
;
; Home Up PgUp
; Left Right correspond to 8 obvious directions
; End Dn PgDn
;
; zoom there are now ten levels of magnification available. If the
; program is assembled with FEATURES defined, the number
; corresponding to the zoom level (0-9, zero is most zoomed in)
; is displayed in the upper left hand corner of the screen just
; before each new fractal is drawn. The gray '+' key zooms out,
; the gray '-' key zooms in.
;
; beep the program will beep at the completion of each fractal
; drawing or if the user attempts to zoom past either limit.
;
; mode if the program is assembled with MODECHANGE defined, the
; will change to the next video mode if the 'v' key is pressed.
; This is handy because drawing fractals at high resolution can
; be very timeconsuming. The user can find an interesting spot
; in a low res mode and then change to a high res mode to see it
; more fully rendered.
;
; size this whole project was started off as a size optimization
; exercise, so there have been some rather ugly tradeoffs to
; sacrifice speed for size.
;
; 8086 yes, it runs on an 8086 although only if you leave out either
; the FEATURES option or the MODECHANGE option and it would be
; slower and more painful than oral surgery.
;
; cost there IS such a thing as a free lunch! This code is hereby
; released to the public domain by the author.
;
;
; to assemble &amp; link:
; TASM /m2 tinyfrac (assemble using two pass mode if required)
; TLINK /Tdc tinyfrac (link Target platform is DOS, COM file)
;
;
 
PIXWIDTH equ 511
PIXHEIGHT equ 255
 
ZOOMLIMIT equ 13 ; can change to up to 13 for extended zoom in
 
; feel free to experiment with the following constants:
 
DELTA equ 200 ; the unit of pan movement in pixels
THRESHOLD equ 7 ; must be in the range of (0,255)
STARTSCALE equ 5 ; a number from 0 to ZOOMLIMIT, inclusive
CHAR_COLOR equ 0fh ; white on black background (for PRINTZOOM feature)
 
 
 
; ************************************************************
;
; Menuet header
 
 
use32
 
org 0x0
 
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x62000
dd 0x1000
dd 0,0
 
include 'lang.inc'
include 'macros.inc'
 
STARTX dd 200
STARTY dd 120
 
scaleaddy dd 120
scaleaddx dd 200
 
START:
 
call draw_window
 
call draw_fractal
 
still:
 
mov eax,10
int 0x40
 
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
 
jmp still
 
red:
call draw_window
call put_image
jmp still
 
key:
mov eax,2
int 0x40
 
cmp ah,'e'
je cycle
cmp ah,'r'
je cycle
jmp no_cycle
cycle:
call color_cycle
jmp still
no_cycle:
 
cmp ah,'q'
jne no_in
inc byte [scale]
mov ebx,[STARTX]
imul ebx,2
sub ebx,[scaleaddx]
mov [STARTX],ebx
mov ebx,[STARTY]
imul ebx,2
sub ebx,[scaleaddy]
mov [STARTY],ebx
no_in:
 
cmp ah,'w'
jne no_out
dec byte [scale]
mov ebx,[STARTX]
add ebx,[scaleaddx]
shr ebx,1
mov [STARTX],ebx
mov ebx,[STARTY]
add ebx,[scaleaddy]
shr ebx,1
mov [STARTY],ebx
no_out:
 
cmp ah,130+48
jne no_up
sub [STARTY],100
no_up:
 
cmp ah,129+48
jne no_down
add [STARTY],100
no_down:
 
cmp ah,128+48
jne no_left
sub [STARTX],100
no_left:
 
cmp ah,131+48
jne no_right
add [STARTX],100
no_right:
 
call draw_fractal
jmp still
 
button:
mov eax,17
int 0x40
 
cmp ah,1
jne no_close
mov eax,-1
int 0x40
no_close:
 
cmp ah,2
jne no_bgr
 
mov eax,15 ; bgr 512 x 256
mov ebx,1
mov ecx,512
mov edx,256
int 0x40
 
mov eax,15
mov ebx,5
mov ecx,0x1000
mov edx,0
mov esi,512*3*256
int 0x40
 
mov eax,15
mov ebx,3
int 0x40
 
jmp still
 
no_bgr:
 
cmp ah,3
jb no_color
cmp ah,5
jg no_color
shr eax,8
sub eax,3
imul eax,8
add eax,8
not eax
and eax,11000b
; sub eax,8
mov [shlc],al
call draw_fractal
jmp still
 
no_color:
 
 
jmp still
 
 
color_cycle:
 
pusha
mov ecx,0x08080808
mov esi,(256/8)*5
cmp ah,'e'
je f_out
mov ecx,-0x08080808
mov esi,(256/8)*5-1
f_out:
 
newcycle:
mov edi,0x1000
newpix:
mov eax,[edi]
add eax,ecx
mov [edi],eax
add edi,4
cmp edi,0x1000+512*256*3
jb newpix
call put_image
mov eax,5
mov ebx,1
int 0x40
dec esi
jnz newcycle
 
mov eax,0
mov edi,0x1000
mov ecx,512*256*3 / 4 +50
cld
rep stosd
 
popa
 
call draw_fractal
 
ret
 
 
 
 
 
; **********************************************************************
;
; Tinyfrac
;
 
 
draw_fractal:
 
pusha
mov eax,4
mov ebx,15*65536+35
mov ecx,0xffffff
mov edx,calc
mov esi,calcl-calc
int 0x40
popa
pusha
 
movzx ebp,word [STARTX]
movzx edi,word [STARTY]
 
 
; This routine is the fractal drawing engine. It has been
; optimized for size, sacrificing speed.
 
mov cx, PIXHEIGHT ; height of screen in pixels
 
sub di,cx ; adjust our Y offset
@@CalcRow:
 
push cx
 
; and cl,0x7
; cmp cl,0
; jne noim
; call put_image
; noim:
 
mov cx, PIXWIDTH -1 ; width of screen in pixels
 
sub bp,cx ;
@@CalcPixel:
push cx ; save the column counter on stack
xor cx, cx ; clear out color loop counter
xor bx, bx ; zero i coefficient
xor dx, dx ; zero j coefficient
@@CycleColors:
push dx ; save j value for later
mov ax, bx ; ax = i
sub ax, dx ; ax = i - j
add dx, bx ; dx = i + j
stc ; one additional shift, please
call Shifty ; ax = ((i+j)*(i-j)) shifted right
pop dx ; retrieve our saved value for j
add ax,bp ; account for base offset...
cmp ah,THRESHOLD ; Q: is i &gt; THRESHOLD * 256?
xchg bx,ax ; now swap new i with old i
jg @@draw ; Y: draw this pixel
clc ; no additional shifts here, please
call Shifty ; now dx:ax = old i * j
xchg dx,ax ;
add dx,di ; account for base offset...
inc cl ; increment color
jnz @@CycleColors ; keep going until we're done
@@draw:
xchg ax, cx ; mov color into al
pop cx ; retrieve our column counter
pop dx ; fetch row (column already in cx)
push dx ; must leave a copy on the stack
xor bx,bx ; write to video page zero
 
call put_pixel
 
inc bp
loop @@CalcPixel
inc di
pop cx
loop @@CalcRow
 
call put_image
 
popa
 
ret
 
 
put_image:
 
pusha
 
mov eax,7
mov ebx,0x1000
mov ecx,512*65536+255
mov edx,10*65536+30
int 0x40
 
popa
 
ret
 
 
shlc db 0
 
put_pixel:
 
pusha
sub edi,[STARTY]
sub ebp,[STARTX]
and edi,0xff
and ebp,0x1ff
shl edi,9
mov ebx,edi ; * 3 - Y
add edi,ebx
add edi,ebx
mov ebx,ebp
add ebp,ebx
add ebp,ebx
add edi,ebp
mov cl,[shlc]
mov ebx,0xff
shl ebx,cl
add cl,3
shl eax,cl
and eax,ebx
mov [0x1000+edi],eax
popa
 
ret
 
 
;****************************************************************************
;
; This routine multiplies AX by DX and shifts the result (in
; DX:AX) to the right by scale bits (or scale+1 bits if CY is
; set). The resulting value is left in AX. DX is destroyed.
;
;****************************************************************************
 
Shifty:
push cx ; save middle bits (i*i - j*j)
db 0b1h ; code for mov cl,immed8
scale db STARTSCALE
adc cl,0 ; adjust per CY flag
imul dx ; do the multiply
 
xchg ax,dx ;
shl eax,16 ; put hi part in hi 16 bits
xchg ax,dx
shr eax,cl ;
 
pop cx ;
ret ;
 
 
 
; **********************************************************************
;
; WINDOW DEFINITIONS AND DRAW
;
; **********************************************************************
 
 
 
draw_window:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0
mov ebx,50*65536+531
mov ecx,100*65536+256+48
mov edx,0x02334455
mov esi,0x80778899
mov edi,0x00778899
int 0x40
 
mov eax,8
mov ebx,(531-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x808080
int 0x40
 
mov eax,8
mov ebx,300*65536+112
mov ecx,5*65536+12
mov edx,2
mov esi,0x808080
int 0x40
 
mov ebx,430*65536+12
mov ecx,5*65536+12
mov edx,3
mov esi,0xa00000
mov edi,3
newcolor:
mov eax,8
int 0x40
add ebx,13*65536
shr esi,8
inc edx
dec edi
jnz newcolor
 
mov eax,4
mov ebx,8*65536+8
mov ecx,0xffffff
mov edx,l
mov esi,ll-l
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
 
; ***************************************************************
;
; DATA AREA
;
 
 
l: db 'TINYFRAC - MOVE: ARROWS, ZOOM Q/W, CYCLE: E/R '
db 'SET AS WALLPAPER'
ll:
 
calc db 'CALCULATING'
calcl:
 
I_END:
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tinypad.asm tinypad
@pause
/programs/tinypad/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tinypad.asm tinypad
@pause
/programs/tinypad/trunk/helpwnd.asm
0,0 → 1,57
help_thread_start:
call draw_help_wnd
 
still_hw:
cmp [main_closed],1
je exit_hw
mcall 10
cmp eax,1
je help_thread_start
cmp eax,2
je key_hw
cmp eax,3
je button_hw
jmp still_hw
 
key_hw:
mcall ;2
cmp ah, 27
jne still_hw
 
button_hw:
mcall 17
exit_hw:
mcall -1
 
func draw_help_wnd
mcall 12,1
 
mcall 48,3,sc,sizeof.system_colors
 
mov ecx,[skinh]
add ecx,200*65536+(5+10*2+16*10)
mov edx,[sc.work]
or edx,0x03000000
mcall 0,<200,10+10*2+help_text.maxl*6>
 
mov ebx,[skinh]
shr ebx,1
adc ebx,1+0x000A0000-4
mcall 4,,[sc.grab_text],help_title,help_title.size
 
mov eax,4
mov ebx,[skinh]
add ebx,0x000F000A
xor ecx,ecx
mov edx,help_text
@@: inc edx
movzx esi,byte[edx-1]
mcall
add ebx,10
add edx,esi
cmp byte[edx],0
jne @b
 
mcall 12,2
ret
endf
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad/trunk/macros.inc
0,0 → 1,387
; language for programs
 
@^ fix macro comment {
^@ fix }
 
 
; 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
name:
db data
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
forward
if lang eq lng
db data
end if
common
.size = $-name
end if
}
 
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
common
local s,m
m = 0
if used name
label name
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
.size = $-name
.maxl = m
end if
}
 
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
common
local s,m
m = 0
if used name
label name
forward
if lang eq lng
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
end if
common
.size = $-name
.maxl = m
end if
}
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
;macro __mov reg,a { ; mike.dld
; if ~a eq
; mov reg,a
; end if
;}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
; -------------------------
macro header a,[b] {
common
use32
org 0
db 'MENUET',a
forward
if b eq
dd 0
else
dd b
end if }
macro section name { align 16
label name }
macro func name {
if ~used name
display 'FUNC NOT USED: ',`name,13,10
else
align 4
name:
;pushad
;pushfd
;dps `name
;newline
;mcall 5,1
;popfd
;popad
}
macro endf { end if }
 
macro diff16 title,l1,l2
{
local s,d
s = l2-l1
display title,': 0x'
repeat 8
d = '0' + s shr ((8-%) shl 2) and $0F
if d > '9'
d = d + 'A'-'9'-1
end if
display d
end repeat
display 13,10
}
 
macro diff10 title,l1,l2
{
local s,d,z,m
s = l2-l1
z = 0
m = 1000000000
display title,': '
repeat 10
d = '0' + s / m
s = s - (s/m)*m
m = m / 10
if d <> '0'
z = 1
end if
if z <> 0
display d
end if
end repeat
display 13,10
}
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
struc POINT _t,_dx,_dy {
.x _t _dx
.y _t _dy
}
 
; structure definition helper
;include 'struct.inc'
 
macro union [def]
{
common size@union = 0
origin@union = $
forward virtual
def
if $-origin@union > size@union
size@union = $-origin@union
end if
end virtual
common rb size@union
}
 
; 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)
}
sizeof.process_information=1024
 
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 ?
}
sizeof.system_colors=40
 
; 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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad/trunk/struct.inc
0,0 → 1,184
 
; Macroinstructions for defining data structures
 
macro struct name
{ fields@struct equ name
match child parent, name \{ fields@struct equ child,fields@\#parent \}
sub@struct equ
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
macro db [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,db,<val> \}
macro dw [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dw,<val> \}
macro du [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,du,<val> \}
macro dd [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dd,<val> \}
macro dp [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dp,<val> \}
macro dq [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dq,<val> \}
macro dt [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dt,<val> \}
macro rb count \{ \local anonymous
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
macro rw count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
macro rd count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
macro rp count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
macro rq count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
macro rt count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \}
virtual at 0 }
 
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
fields@\\#name equ fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
 
macro make@struct name,[field,type,def]
{ common
if $
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
err
end if
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
 
macro define@struct name,[field,type,def]
{ common
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
label name#.#type
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label .
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common \\\} \\} \} }
 
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,name,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
 
enable@substruct
 
macro define@union parent,name,[field,type,def]
{ common
virtual at parent#.#name
forward
if ~ field eq .
virtual at parent#.#name
parent#field type def
sizeof.#parent#field = $ - parent#field
end virtual
if sizeof.#parent#field > $ - parent#.#name
rb sizeof.#parent#field - ($ - parent#.#name)
end if
else
label name#.#type at parent#.#name
if sizeof.#type > $ - parent#.#name
rb sizeof.#type - ($ - parent#.#name)
end if
end if
common
sizeof.#name = $ - parent#.#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 parent#.#name
forward
if ~ field eq .
parent#field type def
sizeof.#parent#field = $ - parent#field
else
label name#.#type
rb sizeof.#type
end if
common
sizeof.#name = $ - parent#.#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 \} }
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad/trunk/tinypad.asm
0,0 → 1,2946
;******************************************************************************
; project name: TINYPAD
; compiler: flat assembler 1.60
; memory to compile: 2 Mbytes +
; version: 3.78a
; last update: 13/05/2005
; maintained by: Ivan Poddubny, Mike Semenyako (aka mike.dld)
; e-mail: ivan-yar@bk.ru, mike.dld@tut.by
;******************************************************************************
; HISTORY:
; 3.79 (just some ideas for further releases)
; optimize drawing (reduce flickering)
; optimize memory usage (allocate only needed amount, not static 3 Mbytes)
; improve keyboard handling (use 66th function)
; introduce real selection capabilities (including block selection)
; and of course other small speed and size optimizations ;)
; 3.78a (mike.dld)
; fixed termination while typing in x positions higher than (line_length+10)
; improved drawing on small heights
; don't draw window while its height equals 0
; 3.78 (mike.dld)
; now lines may be of ANY length;
; optimized memory usage (less memory for internal file representation)
; after loading file, it's internal size equals to its real size
; plus 14 bytes for each line (4 bytes for line length
; and 10 spaced to the end - to reduce data relocations)
; completely rewritten keyboard handling;
; added horizontal scrollbar;
; all line feed formats are supported: WIN(CRLF),*NIX(LF),MAC(CR);
; etc.
; 3.77 (mike.dld)
; changed save_string to collapse SPACEs into TABs;
; rewrote drawfile from scratch (speed++)
; through some drawing improvements still needed
; (some checkups to reduce flickering);
; writepos (size--);
; fixed drawing window while height < 100px, and for non-asm files;
; several small fixes; speed/size optimizations
; 3.76 (mike.dld)
; changed loadfile/loadhdfile to expand TABs into SPACEs;
; changed TAB,ENTER,DELETE,BSPACE keys behaviour (rewritten from scratch);
; vertical scrollbar;
; extra window resizing capabilities (added a couple of constants);
; completely new text cursor management & moving text cursor with mouse;
; improved search function, moving cursor to beginning of text found;
; adjustable max line width (change LINE_WIDTH & recompile) // (obsolete)
; 3.75a
; fixed converting char to upper case in read_string
; 3.75
; rewrote save_file from scratch; bugfix in loadfile;
; 3.74
; optimisation
; 3.73
; completly new load_file function
; 3.72
; speed++
; 3.71
; error beep
; 3.6,3.7:
; many bugs fixed
; simple toolbar
; compile, run applications from TINYPAD, all fasm output is in debug board
; TAB button
; auto-indent
; Ctrl+L - insert comment string
;******************************************************************************
; Memory 0x300000:
; stack 0x00eff0 - áâíª
; stack for help 0x00fff0 -
; load position 0x010000 +  ¤à¥á § £à㧪¨ ä ©« 
; screen comp 0x078000 + ᮤ¥à¦¨¬®¥ íªà ­  (obsolete)
; edit area 0x080000 + ¤®ªã¬¥­â
; copy/paste area 0x2f0000 + ®¡« áâì ¤«ï ª®¯¨à®¢ ­¨ï/¢áâ ¢ª¨
;******************************************************************************
 
include 'lang.inc'
include 'macros.inc' ; useful stuff
purge mov ;  SPEED
 
macro mov op1,op2 {
if (op1 in __regs) & (op2 eq -1)
or op1,-1
else
mov op1,op2
end if
}
 
header '01',1,@CODE,TINYPAD_END,0x300000,0xeff0,@PARAMS,0
 
ASEPC = '-'
RBTNW = rstr.size*6/3
LBTNW = lstr.size*6/2
ABTNH = 16
ATOPH = 24
OLEFT = 5+1
SCRLW = 16
ATABW = 8
PATHL = 260
 
AMINS = 8
 
;-----------------------------------------------------------------------------
section @CODE ;///////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
 
;******************************************************************************
; INITIALIZING
 
cld
mov esi,s_example
mov edi,s_fname
mov ecx,s_example.size
mov [s_fname.size],ecx
rep movsb
mov esi,s_still
mov edi,s_search
mov ecx,s_still.size
mov [s_search.size],ecx
rep movsb
cmp byte[@PARAMS],0
jz no_params
 
; parameters are at @PARAMS
mov esi,@PARAMS
mov edi,s_fname
mov ecx,PATHL
rep movsb
mov edi,s_fname
mov ecx,PATHL
xor al,al
repne scasb
sub edi,s_fname+1
mov [s_fname.size],edi
 
no_params:
mcall 40,00100111b
jmp do_load_file
 
;******************************************************************************
; MAIN LOOP
still:
call writepos ; write current position & number of strings
 
.skip_write:
mcall 10;23,50; wait here until event
dec eax ; redraw ?
jz red
dec eax ; key ?
jz key
dec eax ; button ?
jz button
sub eax,3 ; mouse ?
jz mouse
 
;d
 
jmp still.skip_write
;******************************************************************************
 
mouse:
mcall 9,p_info,-1
cmp ax,[p_info.window_stack_position]
jne still
 
mcall 37,2
test al,1
jz .capture_off
 
mcall 37,1
mov ebx,eax
and ebx,0x0000FFFF
shr eax,16
 
mov ecx,[top_ofs]
inc ecx
pushd OLEFT ecx [p_info.x_size] ecx
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
sub [__rc+0x8],SCRLW+5+3
imul ecx,[slines],10
dec ecx
add [__rc+0xC],ecx
mov ecx,__rc
call pt_in_rect
jnc .check_vscroll
sub eax,OLEFT
sub ebx,[__rc+0x4]
push eax
mov eax,ebx
xor edx,edx
mov ecx,10
div ecx
@@: add eax,[top_line]
mov ebx,eax
pop eax
xor edx,edx
mov ecx,6
div ecx
@@: add eax,[left_col]
 
cmp eax,[columns]
jb @f
mov eax,[columns]
@@: cmp ebx,[lines]
jb @f
mov ebx,[lines]
dec ebx
@@:
cmp [posx],eax
jne .change_cur_pos
cmp [posy],ebx
je still.skip_write
 
.change_cur_pos:
mov [posx],eax
mov eax,[posy]
pushd ebx
popd [posy]
cmp eax,ebx
je @f
push ebx
mov ebx,eax
call drawfile.ex
pop eax
@@: mov ebx,eax
call drawfile.ex
jmp still
 
.check_vscroll:
mov ecx,[p_info.x_size]
sub ecx,SCRLW+5-2
pushd ecx [top_ofs] ecx [bot_ofs]
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
add [__rc+0x8],SCRLW-2
add [__rc+0x4],SCRLW+1
sub [__rc+0xC],SCRLW*2+3
mov ecx,__rc
call pt_in_rect
jnc .check_hscroll
 
sub ebx,[__rc+0x4]
cmp [vscrl_capt],0
jge .vcaptured
mov eax,[vscrl_top]
cmp ebx,eax
jb .center_vcapture
add eax,[vscrl_size]
cmp ebx,eax
jae .center_vcapture
mov eax,ebx
sub eax,[vscrl_top]
dec eax
mov [vscrl_capt],eax
dec ebx
jmp .vcaptured
.center_vcapture:
mov eax,[vscrl_size]
shr eax,1
mov [vscrl_capt],eax
.vcaptured:
sub ebx,[vscrl_capt]
jns @f
xor ebx,ebx
@@:
mov [vscrl_top],ebx
mov eax,[lines]
sub eax,[slines]
mul ebx
mov ebx,[bot_ofs]
sub ebx,[top_ofs]
sub ebx,SCRLW*3+2+2 ;**
sub ebx,[vscrl_size]
div ebx
cmp eax,[top_line]
je still.skip_write
mov [top_line],eax
call check_bottom_right
call drawfile
jmp still.skip_write
 
.check_hscroll:
pushd (OLEFT+SCRLW+1) [bot_ofs] [p_info.x_size] [bot_ofs]
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
add [__rc+0x8],-SCRLW*2-10-1
add [__rc+0x4],-SCRLW
add [__rc+0xC],-2
mov ecx,__rc
call pt_in_rect
jnc .capture_off
 
mov ebx,eax
sub ebx,[__rc+0x0]
cmp [hscrl_capt],0
jge .hcaptured
mov eax,[hscrl_top]
cmp ebx,eax
jb .center_hcapture
add eax,[hscrl_size]
cmp ebx,eax
jae .center_hcapture
mov eax,ebx
sub eax,[hscrl_top]
dec eax
mov [hscrl_capt],eax
dec ebx
jmp .hcaptured
.center_hcapture:
mov eax,[hscrl_size]
shr eax,1
mov [hscrl_capt],eax
.hcaptured:
sub ebx,[hscrl_capt]
jns @f
xor ebx,ebx
@@:
mov [hscrl_top],ebx
mov eax,[columns]
sub eax,[scolumns]
mul ebx
mov ebx,[p_info.x_size]
sub ebx,SCRLW*3+10+2 ;**
sub ebx,[hscrl_size]
div ebx
cmp eax,[left_col]
je still.skip_write
mov [left_col],eax
call check_bottom_right
call drawfile
jmp still.skip_write
 
.capture_off:
or [vscrl_capt],-1
or [hscrl_capt],-1
jmp still.skip_write
 
func pt_in_rect
cmp eax,[ecx+0x0]
jl @f
cmp ebx,[ecx+0x4]
jl @f
cmp eax,[ecx+0x8]
jg @f
cmp ebx,[ecx+0xC]
jg @f
stc
ret
@@: clc
ret
endf
 
func check_bottom_right
push eax
mov eax,[top_line]
add eax,[slines]
cmp eax,[lines]
jbe .lp1
mov eax,[lines]
sub eax,[slines]
jns @f
xor eax,eax
@@: mov [top_line],eax
.lp1: mov eax,[left_col]
add eax,[scolumns]
cmp eax,[columns]
jbe .exit
mov eax,[columns]
sub eax,[scolumns]
jns @f
xor eax,eax
@@: mov [left_col],eax
.exit:
pop eax
ret
endf
 
; *********************************
; * BUTTON HANDLER *
; *********************************
 
button:
 
mcall 17
shr eax,8
 
cmp eax,'UP'
jne not_up
dec [top_line]
jns check_inv_all.skip_check
mov [top_line],0
jmp still.skip_write
not_up:
 
cmp eax,'DN'
jne not_down
inc [top_line]
mov eax,[lines]
sub eax,[slines]
cmp eax,[top_line]
jae check_inv_all.skip_check
dec eax
mov [top_line],eax
jmp still.skip_write
not_down:
 
cmp eax,'LT'
jne not_left
dec [left_col]
jns check_inv_all.skip_check
mov [left_col],0
jmp still.skip_write
not_left:
 
cmp eax,'RT'
jne not_right
inc [left_col]
mov eax,[columns]
sub eax,[scolumns]
cmp eax,[left_col]
jae check_inv_all.skip_check
dec eax
mov [left_col],eax
jmp still.skip_write
not_right:
 
; SEARCH {
search:
cmp al,50
jne no_search
 
.skip_check:
 
cld
mov ecx,[posy]
mov edx,ecx
call get_line_offset
cmp dword[esi],0
je still
call get_real_length
add esi,4
or eax,eax
jz .end_line.2
mov ecx,eax
sub ecx,[posx]
push esi
add esi,[posx]
dec ecx
inc esi
jmp @f
 
.next_line:
push esi
@@:
sub ecx,[s_search.size]
inc ecx
 
.next_char:
dec ecx
js .end_line
xor edi,edi
 
.next_ok:
movzx eax,byte[edi+esi]
movzx ebx,byte[edi+s_search]
 
cmp al,$61
jb @f
add al,[eax+add_table-$61]
@@: cmp bl,$61
jb @f
add bl,[ebx+add_table-$61]
@@:
 
cmp al,bl
je @f
 
inc esi
jmp .next_char
@@:
inc edi
cmp edi,[s_search.size]
jne .next_ok
 
.found:
add esp,4
mov [posy],edx
mov ecx,edx
lea eax,[esi-4]
call get_line_offset
sub eax,esi
mov [posx],eax
jmp check_inv_all
 
.end_line:
pop esi
.end_line.2:
add esi,[esi-4]
inc edx
call get_real_length
mov ecx,eax
lodsd
or eax,eax
jnz .next_line
jmp still
 
; SEARCH }
 
no_search:
 
; TOOLBAR {
cmp eax,10000
jb no_toolbar
 
add eax,-10000
jnz @f
mov bl,0;[run_outfile],0
call start_fasm
jmp still
@@: dec eax
jnz @f
mov bl,1;[run_outfile],1
call start_fasm
jmp still
@@: dec eax
jnz @f
call open_debug_board
jmp still
@@: dec eax
jnz still
call open_sysfuncs_txt
jmp still
; TOOLBAR }
 
no_toolbar:
 
cmp al,4
jne noid4
 
; LOAD_FILE {
do_load_file:
cmp [s_fname],'/'
jne @f
call loadhdfile
jmp .restorecursor
@@: call loadfile
 
.restorecursor:
xor eax,eax
mov [top_line],eax
mov [posx],eax
mov [posy],eax
 
; enable color syntax for ASM and INC files:
mov [asm_mode],al
 
mov eax,[s_fname.size]
add eax,s_fname
mov byte[eax],0
cmp dword[eax-3],'ASM'
jne @f
inc [asm_mode]
jmp .nocol
@@: cmp dword[eax-3],'INC'
jne .nocol
inc [asm_mode]
.nocol:
 
; if the header is the same as previous,
; just redraw the text area
; else redraw the window
 
mov ecx, [s_fname.size]
add ecx, 10 ; strlen(" - TINYPAD");
cmp ecx, [s_title.size]
jne @f
add ecx, -10
mov esi, s_fname ; strcmp(s_fname,header);
mov edi, s_title
rep cmpsb
jne @f
call drawfile
jmp still
@@:
 
; set window title:
mov esi,s_fname
mov edi,s_title
mov ecx,[s_fname.size]
lea eax,[ecx+10]
mov [s_title.size],eax
cld
rep movsb
 
mov dword[edi],' - '
add edi,3
mov esi,htext
mov ecx,htext.size
rep movsb
 
call drawwindow
jmp still
; LOAD_FILE }
 
noid4:
 
cmp al, 2
jz yessave
 
dec al ; close if butid == 1
jnz nosave
; EXIT:
mov [main_closed],1
mcall -1
 
; SAVE_FILE {
yessave:
call save_file
jmp still
; SAVE_FILE }
 
nosave:
inc al
call read_string
jmp still
 
;**********************************
;* REDRAW HANDLER *
;**********************************
 
func red
; ¯¥à¥à¨á®¢ª  ®ª­ 
call drawwindow
jmp check_inv_all.skip_check
endf
 
;**********************************
;* KEY HANDLER *
;**********************************
 
key:
mcall 2 ; GET KEY
cmp al,1
je still
 
shr eax,8
 
; HELP_WND {
cmp al,0xD2;210 ; Ctrl + F1
jne no_help_text
 
mcall 51,1,help_thread_start,0xfff0
jmp still
; HELP_WND }
 
no_help_text:
; LOAD_FILE {
cmp al,211 ; Ctrl + F2
je do_load_file
; LOAD_FILE }
 
; SEARCH {
cmp al,212 ; Ctrl + F3
je search.skip_check
; SEARCH }
 
; SAVE_FILE {
cmp al,213 ; Ctrl + F4
je yessave
; SAVE_FILE }
 
; ENTER_FILENAME {
cmp al,214 ; Ctrl + F5
jne @f
mov al,5
call read_string
jmp still
@@:
; ENTER_FILENAME }
 
; ENTER_SEARCH {
cmp al,215 ; Ctrl + F6
jne @f
mov al,51
call read_string
jmp still
@@:
; ENTER_SEARCH }
 
; CHANGE_LANG_LAYOUT {
cmp al,217 ; Ctrl + F8
jne @f
call layout
jmp still
@@:
; CHANGE_LANG_LAYOUT }
 
; 3 times english -> àãá᪨©
; 2 times àãá᪨© -> english
 
; COPY START {
cmp al,19
jne no_copy_start
push [posy]
pop [copy_start]
jmp still
; COPY START }
 
no_copy_start:
 
; COPY END {
cmp al,5
jne no_copy_end
mov eax,[posy]
cmp eax,[copy_start]
jae @f
xchg eax,[copy_start]
@@: sub eax,[copy_start]
inc eax
mov [copy_count],eax
 
mov ecx,[copy_start]
call get_line_offset
push esi
mov ecx,eax
@@: lodsd
add esi,eax
loop @b
mov ecx,esi
pop esi
sub ecx,esi
mov [copy_size],ecx
 
mov edi,0x2f0000
cld
rep movsb
jmp still
; COPY END }
 
no_copy_end:
 
; PASTE {
cmp al,16
jne no_copy_paste
mov ebx,[copy_count]
or ebx,ebx
jz still
add [lines],ebx
 
mov ecx,[posy]
call get_line_offset
mov ebx,esi
mov edi,0x2E0000
mov esi,edi
mov ecx,[copy_size]
sub esi,ecx
lea ecx,[esi+4]
sub ecx,ebx
std
rep movsb
mov edi,ebx
mov esi,0x2F0000
mov ecx,[copy_size]
cld
rep movsb
 
jmp check_inv_all
; PASTE }
 
no_copy_paste:
 
; INSERT_SEPARATOR {
cmp al,0x0C ; Ctrl+L
jne no_insert_separator
 
mov ecx,[posy]
call get_line_offset
mov ebx,esi
 
mov ecx,[lines]
call get_line_offset
lea edi,[esi+90+4]
lea ecx,[esi+4]
sub ecx,ebx
std
rep movsb
 
lea edi,[ebx+5]
mov dword[ebx],90
mov al,ASEPC
mov ecx,79
cld
rep stosb
mov al,' '
mov ecx,10
rep stosb
mov byte[ebx+4],';'
 
inc [lines]
inc [posy]
 
jmp check_inv_all
; INSERT_SEPARATOR }
 
no_insert_separator:
 
; DEL_LINE {
cmp al,4
jne no_delete_line
 
mov eax,[posy]
inc eax
cmp eax,[lines]
jge still
 
mov ecx,[posy]
call get_line_offset
mov edi,esi
lodsd
add esi,eax
 
dec [lines]
mov ecx,0x2e0000
sub ecx,esi
shr ecx,2 ;// fixed (was 4)
cld
rep movsd
jmp check_inv_all
; DEL_LINE }
 
no_delete_line:
 
; ENTER {
cmp al,13
jnz noenter
 
mov ecx,[posy]
call get_line_offset
 
mov ebx,[posx]
cmp ebx,[esi]
jb @f
mov ebx,[esi]
dec ebx
jns @f
xor ebx,ebx
@@:
 
cld
 
mov edi,0x10000
mov ebp,esi
mov ecx,ebx
inc ecx
@@: dec ecx
jz @f
cmp byte[esi+ecx+4-1],' '
je @b
@@: lea eax,[ecx+10]
stosd
jecxz @f
push esi
add esi,4
rep movsb
pop esi
@@: mov al,' '
mov ecx,10
rep stosb
 
mov ecx,[esi]
sub ecx,ebx;[posx]
add esi,ebx;[posx]
add esi,4
inc ecx
@@: dec ecx
jz @f
cmp byte[esi+ecx-1],' '
je @b
@@: jz .lp1
@@: cmp byte[esi],' '
jne .lp1
inc esi
loop @b
.lp1: push edi ecx
mov ecx,[ebp]
lea edi,[ebp+4]
mov al,' '
repe scasb
mov eax,ecx
pop ecx edi
je .lp2
neg eax
add eax,[ebp]
dec eax
jmp @f
.lp2: xor eax,eax
@@: mov edx,edi
add edi,4
mov [posx],eax
jecxz @f
push ecx
mov ecx,eax
mov al,' '
rep stosb
pop ecx
@@: jecxz @f
rep movsb
@@: mov ecx,10
mov al,' '
rep stosb
 
lea eax,[edi-4]
sub eax,edx
mov [edx],eax
 
lea ecx,[edi-0x10000]
 
push ecx
mov edi,0x2E0000
lea esi,[edi+4]
sub esi,ecx
add esi,[ebp]
lea ecx,[esi-4]
sub ecx,ebp
std
cmp esi,edi
jb @f
je .lp3
lea esi,[ebp+4]
mov eax,[esp]
lea edi,[esi+eax-4]
add esi,[ebp]
mov ecx,0x2E0000
sub ecx,esi
cld
@@: rep movsb
.lp3: pop ecx
mov esi,0x10000
mov edi,ebp
cld
rep movsb
 
inc [posy]
inc [lines]
 
jmp check_inv_all
; ENTER }
 
noenter:
 
; UP {
cmp al,130+48
jnz noup
 
mov eax,[posy]
dec eax
jns @f
xor eax,eax
@@: mov ecx,[top_line]
cmp eax,ecx
jae @f
dec ecx
jns @f
xor ecx,ecx
@@: jmp check_inv_all.skip_init
; UP }
 
noup:
 
; DOWN {
cmp al,129+48
jnz nodown
 
mov eax,[posy]
inc eax
cmp eax,[lines]
jb @f
dec eax
@@: mov ecx,[top_line]
mov edx,eax
sub edx,ecx
cmp edx,[slines]
jb @f
inc ecx
@@: jmp check_inv_all.skip_init
; DOWN }
 
nodown:
 
; LEFT {
cmp al,128+48
jnz noleft
mov eax,[posx]
dec eax
jns @f
inc eax
@@: mov [posx],eax
jmp check_inv_all
; LEFT }
 
noleft:
 
; RIGHT {
cmp al,131+48
jnz noright
mov eax,[posx]
inc eax
cmp eax,[columns]
jbe @f
dec eax
@@: mov [posx],eax
jmp check_inv_all
; RIGHT }
 
noright:
 
; PAGE_UP {
page_up:
cmp al,136+48
jnz nopu
mov edx,[slines]
dec edx
mov eax,[posy]
mov ecx,[top_line]
sub eax,edx
jns @f
xor eax,eax
@@: sub ecx,edx
jns @f
xor ecx,ecx
@@: jmp check_inv_all.skip_init
; PAGE_UP }
 
nopu:
 
; PAGE_DOWN {
page_down:
cmp al,135+48
jnz nopd
mov edx,[slines]
dec edx
mov eax,[posy]
mov ecx,[top_line]
add eax,edx
add ecx,edx
cmp eax,[lines]
jb @f
mov eax,[lines]
dec eax
@@: jmp check_inv_all.skip_init
; PAGE_DOWN }
 
nopd:
 
; HOME {
cmp al,132+48
jnz nohome
mov [posx],0
jmp check_inv_all
; HOME }
 
nohome:
 
; END {
end_key:
cmp al,133+48
jnz noend
 
mov ecx,[posy]
call get_line_offset
call get_real_length
mov [posx],eax
jmp check_inv_all
; END }
 
noend:
 
; GO_START {
cmp al,251 ; Ctrl + [
jnz no_go_to_start
xor eax,eax
mov [top_line],eax
mov [posy],eax
jmp check_inv_all.skip_check
; GO_START }
 
no_go_to_start:
 
; GO_END {
cmp al,253 ; Ctrl + ]
jnz no_go_to_end
mov eax,[lines] ; eax = lines in the file
mov [posy],eax
sub eax,[slines] ; eax -= lines on the screen
jns @f
xor eax,eax
@@: mov [top_line],eax
dec [posy]
jmp check_inv_all.skip_check
; GO_END }
 
no_go_to_end:
 
; DELETE {
__key_delete:
cmp al,134+48
jne nodel
 
mov ecx,[posy]
call get_line_offset
lea ebx,[esi+4]
mov ebp,esi
 
call get_real_length
or eax,eax
je .line_up
 
mov ecx,[posx]
cmp ecx,eax
jae .line_up
lea edi,[ebx+ecx]
neg ecx
add ecx,[ebp]
repe scasb
je .line_up
 
mov edi,ebx
mov ecx,[posx]
add edi,ecx
lea esi,[edi+1]
neg ecx
add ecx,[ebp]
dec ecx
rep movsb
mov byte[edi],' '
 
jmp check_inv_all
 
.line_up:
mov eax,[lines]
dec eax
cmp eax,[posy]
je still;.ok
mov edi,0x10004
mov esi,ebx
mov ecx,[posx]
rep movsb
mov ecx,[posx]
mov [0x10000],ecx
cmp ecx,[ebp]
jbe @f
sub ecx,[ebp]
sub edi,ecx
mov al,' '
rep stosb
@@: lea esi,[ebx+4]
add esi,[ebp]
mov ecx,[esi-4]
add [0x10000],ecx
rep movsb
 
lea ecx,[edi-0x10000]
 
mov esi,0x10000
call get_real_length
cmp eax,[columns]
jbe @f
mov [columns],eax
@@:
 
push ecx
mov edi,0x2E0000
lea esi,[edi+8]
sub esi,ecx
add esi,[ebp]
lea eax,[ebp+4]
add eax,[ebp]
add esi,[eax]
lea ecx,[esi-4]
sub ecx,ebp
std
cmp esi,edi
jb @f
jz .lp1
mov edi,ebp
add edi,[esp]
lea esi,[ebp+8]
add esi,[esi-8]
add esi,[esi-4]
mov ecx,0x2E0000
sub ecx,esi
cld
@@: rep movsb
.lp1: pop ecx
mov esi,0x10000
mov edi,ebp
cld
rep movsb
 
.ok.dec.lines:
dec [lines]
mov eax,[lines]
cmp [posy],eax
jb check_inv_all
dec eax
mov [posy],eax
jmp check_inv_all
; DELETE }
 
nodel:
 
; INSERT {
cmp al,137+48
jnz noins
;// ... toggle insert/overwrite mode here ...
jmp still;check_inv_str
; INSERT }
 
noins:
 
; BACKSPACE {
cmp al,8
jnz nobs
 
mov eax,[posx]
dec eax
js .line_up
 
dec [posx]
mov ecx,[posy]
call get_line_offset
 
mov ebx,eax
call get_real_length
cmp eax,[posx]
jb check_inv_all
 
lea edi,[esi+4+ebx]
mov ecx,ebx
neg ecx
add ecx,[esi]
dec ecx
lea esi,[edi+1]
cld
rep movsb
mov byte[edi],' '
 
jmp check_inv_str
 
.line_up:
cmp [posy],0
je still
mov ecx,[posy]
dec ecx
call get_line_offset
mov ebp,esi
lea ebx,[esi+4]
mov ecx,[ebp]
@@: cmp byte[ebx+ecx-1],' '
jne @f
dec ecx
jg @b
@@: mov [posx],ecx
dec [posy]
cld
jmp __key_delete.line_up
; BACKSPACE }
 
nobs:
 
; TAB {
__key_tab:
cmp eax,9 ; Tab
jne notab
 
mov eax,[posx]
 
mov ecx,eax
add eax,ATABW
and eax,not(ATABW-1)
push eax ' '
sub eax,ecx
.direct:
mov ecx,[posy]
call get_line_offset
 
xchg eax,ecx
 
call get_real_length
cmp eax,[posx]
jae @f
mov eax,[posx]
@@: mov edx,[esi]
sub edx,eax
cmp ecx,edx
jl @f
pushad; esi ecx eax
mov ecx,0x2E0000-10+1
lea eax,[esi+4]
add eax,[esi]
sub ecx,eax
mov edi,0x2E0000
mov esi,0x2E0000-10
std
rep movsb
mov ecx,10
mov al,' '
rep stosb
popad; eax ecx esi
add dword[esi],10
jmp @b
@@: lea ebx,[esi+4]
push ecx
lea edi,[ebx-1]
add edi,[esi]
mov esi,edi
sub esi,ecx
lea ecx,[esi+1]
sub ecx,ebx
sub ecx,[posx]
std
rep movsb
.ok: pop ecx
pop eax
rep stosb
 
cld
 
pop [posx]
 
lea esi,[ebx-4]
call get_real_length
cmp eax,[posx]
jae @f
mov eax,[posx]
@@: cmp eax,[columns]
jbe @f
mov [columns],eax
@@:
jmp check_inv_all
; TAB }
 
notab:
 
; ADD_KEY {
push [posx] eax
inc dword[esp+4]
mov eax,1
jmp __key_tab.direct
; ADD_KEY }
 
check_inv_str = check_inv_all
@^
func check_inv_str
mov eax,[posy]
mov ecx,[top_line]
.skip_init:
call check_cur_vis
mov [posy],eax
mov [top_line],ecx
.skip_check:
; call invalidate_string
call drawfile
jmp still
endf
^@
func check_inv_all
mov eax,[posy]
mov ecx,[top_line]
.skip_init:
call check_cur_vis
mov [posy],eax
mov [top_line],ecx
.skip_check:
; call clear_screen
call drawfile
jmp still
endf
 
func check_cur_vis
cmp eax,ecx
jb .low
mov edx,ecx
add edx,[slines]
cmp edx,[lines]
jbe @f
mov edx,[lines]
@@: cmp eax,edx
jb @f
lea ecx,[eax+1]
sub ecx,[slines]
jns @f
xor ecx,ecx
jmp @f
.low: mov ecx,eax
@@:
mov edx,ecx
add edx,[slines]
cmp edx,[lines]
jbe @f
mov ecx,[lines]
sub ecx,[slines]
jns @f
xor ecx,ecx
@@:;mov [top_line],eax
 
pushad
mov eax,[posx]
mov ebx,[left_col]
mov ecx,ebx
add ecx,[scolumns]
cmp eax,ebx
jb .lp1
cmp eax,ecx
jb .exit.2
lea ebx,[eax]
sub ebx,[scolumns]
jmp @f
.lp1: mov ebx,eax
@@: mov [left_col],ebx
.exit.2:
mov [posx],eax
popad
 
ret
endf
 
func get_real_length
mov eax,[esi]
@@: cmp byte[esi+eax+4-1],' '
jne @f
dec eax
jnz @b
@@: ret
endf
 
;******************************************************************************
 
;----------------------------------------------------------------------------
func start_fasm ;////////////////////////////////////////////////////////////
;----------------------------------------------------------------------------
; BL = run after compile
;----------------------------------------------------------------------------
cmp [asm_mode],0
jne @f
ret
@@: mov esi,s_fname
mov edi,fasm_parameters
 
cmp byte[esi],'/'
je .yes_systree
 
mov ecx,[s_fname.size]
rep movsb
 
mov al,','
stosb
 
mov ecx,[s_fname.size]
add ecx,-4
mov esi,s_fname
rep movsb
 
mov al,','
stosb
 
mov dword[edi],'/RD/'
mov word[edi+4],'1/'
add edi,6
 
mov al,0
stosb
 
jmp .run
 
.yes_systree:
add esi,[s_fname.size]
dec esi
 
xor ecx,ecx
mov al,'/'
@@: cmp [esi],al
je @f
dec esi
inc ecx
jmp @b
@@: inc esi
 
push esi esi ecx
 
rep movsb
 
mov al,','
stosb
 
pop ecx esi
 
add ecx,-4
rep movsb
 
mov al,','
stosb
 
pop ecx
sub ecx,s_fname
mov esi,s_fname
 
rep movsb
 
mov al,0
stosb
 
.run:
cmp bl,0 ; run outfile ?
je @f
mov dword[edi-1],',run'
mov byte[edi+3],0
@@: mcall 19,fasm_filename,fasm_parameters
ret
endf
 
func open_debug_board
mcall 19,debug_filename,0
ret
endf
 
func open_sysfuncs_txt
mcall 19,tinypad_filename,sysfuncs_filename
ret
endf
 
func layout
; ᬥ­¨âì à áª« ¤ªã ª« ¢¨ âãàë
mcall 19,setup,param_setup
mcall 5,eax
; call activate_me
; ret
;endf
 
;func activate_me
mcall 9,p_info,-1
inc eax
inc eax
mov ecx,eax
mov edi,[p_info.PID]
mov ebx,p_info
@@: dec ecx
jz @f ; counter=0 => not found? => return
mcall 9
cmp edi,[p_info.PID]
jne @b
mcall 18,3
mcall 5,eax
@@: ret
endf
 
; *******************************************************************
; ************************** DRAW WINDOW **************************
; *******************************************************************
 
func drawwindow
 
mcall 48,3,sc,sizeof.system_colors
 
mcall 12,1
 
push [color_tbl+4*5]
pop [sc.work]
 
mov edx,[sc.work]
add edx,0x03000000
mov esi,[sc.grab]
or esi,0x80000000
mcall 0,<100,6*80+6+OLEFT+SCRLW>,<75,402>,,,[sc.frame]
 
mcall 48,4
mov [skinh],eax
push eax
 
mcall 9,p_info,-1
pop eax
cmp [p_info.y_size],0
je .exit.2
 
mov [top_ofs],eax
dec [top_ofs]
cmp [asm_mode],0
je @f
add [top_ofs],ATOPH+1
@@:
; header string
mov ebx,eax
shr ebx,1
adc ebx,1+0x000A0000-4
mcall 4,,[sc.grab_text],s_title,[s_title.size]
 
mov eax,[p_info.x_size]
sub eax,5*2+SCRLW+2
cdq
mov ebx,6
div ebx
mov [scolumns],eax
 
mov eax,[p_info.y_size] ; calculate buttons position
add eax,-5-ABTNH*3-2-2
mov [bot_ofs],eax
 
; mov eax,[procinfo.y_size]
mov [do_not_draw],1 ; do_not_draw = true
 
mov ebx,eax
sub ebx,[skinh]
sub ebx,ATOPH+SCRLW*3+AMINS+5
js .no_draw
 
; cmp eax,100
; jb .no_draw ; do not draw text & buttons if height < 100
 
mov [do_not_draw],0 ; do_not_draw = false
sub eax,SCRLW+2+2
sub eax,[top_ofs]
cdq
mov ebx,10
div ebx
mov [slines],eax
 
mov ebx,[p_info.x_size]
add ebx,5*65536-5
mov ecx,[top_ofs-2]
mov cx,word[top_ofs]
mcall 38,,,[sc.work_text]
mov ecx,[bot_ofs-2]
mov cx,word[bot_ofs]
sub ecx,0x00010001
push ecx
mcall
add ecx,(ABTNH+2)*65536+ABTNH+2
mcall
add ecx,(ABTNH+2)*65536+ABTNH+2
mcall
pop ecx
add cx,(ABTNH+2)*3
mov ebx,[p_info.x_size]
sub ebx,RBTNW+5+1
push bx
shl ebx,16
pop bx
mcall
mov ebx,(5+LBTNW+1)*65536+(5+LBTNW+1)
add ecx,(ABTNH+2)*65536
mcall
 
inc [top_ofs]
 
mov ebx,5*65536
mov bx,word[p_info.x_size]
sub bx,9
push bx
sub bx,RBTNW+2
mov ecx,[bot_ofs-2]
mov cx,ABTNH+1
mcall 13,,,[sc.work_graph] ; BAR STRIPE
 
pop bx
cmp [asm_mode],0
je .skip_top_btns
mov ecx,[skinh-2]
mov cx,ATOPH
mcall ; UPPER BAR
 
mov eax,8
mov ebx,6*65536+52
mov ecx,[skinh]
inc ecx
shl ecx,16
add ecx,ATOPH-3
mov edx,10000
mov esi,[sc.work_button]
@@:
mcall ; TOOLBAR BUTTONS
add ebx,54*65536
inc edx
cmp edx,10004
jb @b
 
.skip_top_btns:
mov ebx,5*65536+LBTNW
mov ecx,[bot_ofs]
shl ecx,16
add ecx,(ABTNH+2)*65536+ABTNH
mcall 8,,,5,[sc.work_button] ; FILE BUTTON
 
add ecx,(ABTNH+2)*65536
mcall ,,,51 ; STRING BUTTON
 
push ebx ecx
 
mov ebx,[p_info.x_size]
shl ebx,16
add ebx,(-5-RBTNW)*65536+RBTNW
mov ecx,[bot_ofs]
shl ecx,16
add ecx,ABTNH
mov edx,2
mcall ,,,2 ; SAVE BUTTON
 
add ecx,(ABTNH+2)*65536
mcall ,,,4 ; FILE BUTTON
 
add ecx,(ABTNH+2)*65536
mcall ,,,50 ; SEARCH BUTTON
 
shr ecx,16
mov bx,cx
add ebx,-ABTNH-2-ABTNH/2-2-3
mcall 4,,[sc.work_button_text],rstr,rstr.size/3
add ebx,ABTNH+2
add edx,rstr.size/3
mcall
add ebx,ABTNH+2
add edx,rstr.size/3
mcall
 
pop edi ebx
shr edi,16
mov bx,di
add ebx,-1-ABTNH/2-2-2
mcall ,,,lstr,lstr.size/2
add ebx,ABTNH+2
add edx,lstr.size/2
mcall
 
cmp [asm_mode],0
je @f
mov ebx,[skinh]
add ebx,0x000C0000+ATOPH/2-4
mcall ,,,toolbar_btn_text,toolbar_btn_text.size
@@:
mov eax,[bot_ofs]
add eax,ABTNH+2
mov [ya],eax
mov [addr],s_fname
call print_text
 
add eax,ABTNH+2
mov [ya],eax
mov [addr],s_search
call print_text
jmp .exit
 
.no_draw:
mov ebx,[skinh]
mov [top_ofs],ebx
mov eax,[p_info.y_size]
add eax,-3
mov [bot_ofs],eax
sub eax,ebx
push eax
add eax,-2-SCRLW
cdq
mov ebx,10
idiv ebx
mov [slines],eax
pop eax
 
mov ebx,[p_info.y_size]
sub ebx,[skinh]
sub ebx,SCRLW*3++AMINS+7
jns @f
 
inc [do_not_draw]
 
add eax,-2
cdq
mov ebx,10
idiv ebx
mov [slines],eax
 
mov eax,[p_info.x_size]
sub eax,5*2
cdq
mov ebx,6
idiv ebx
mov [scolumns],eax
@@:
 
.exit:
call drawfile
.exit.2:
mcall 12,2
ret
endf
 
;--------------------------------------------
func get_line_offset
;--------------------------------------------
; Input:
; ECX = line number
; Output:
; ESI = line data offset
;--------------------------------------------
push eax
mov esi,0x80000
jecxz .exit
@@: lodsd
add esi,eax
loop @b
.exit:
pop eax
ret
endf
 
; **********************************
; *********** DRAWFILE ***********
; **********************************
 
;---------------------------------------------------
func drawfile.ex
;---------------------------------------------------
; Input:
; EAX = start line
; EBX = end line
;---------------------------------------------------
cmp [p_info.y_size],0
jne @f
ret
@@:
call check_bottom_right
 
pushad
 
cmp [slines],0
jle drawfile.exit
 
cmp eax,ebx
jae @f
xchg eax,ebx
@@: cmp eax,[top_line]
jae @f
mov eax,[top_line]
@@: mov ecx,[top_line]
add ecx,[slines]
cmp ebx,ecx
jb @f
dec ecx
mov ebx,ecx
@@: cmp eax,ebx
ja drawfile.exit
 
mov ecx,eax
call get_line_offset
 
.start:
mov ecx,ebx
sub ecx,eax
 
mov ebx,[top_ofs]
add ebx,OLEFT*65536+1
sub eax,[top_line]
imul eax,10
add ebx,eax
 
imul ebp,[left_col],6*65536
 
jmp drawfile.next_line
endf
 
func drawfile
cmp [p_info.y_size],0
jne @f
ret
@@:
call check_bottom_right
 
pushad
 
mov ebx,[top_ofs]
add ebx,OLEFT*65536+1
 
mov ecx,[top_line]
call get_line_offset
 
.start:
mov ecx,[slines]
or ecx,ecx
jle .exit
 
imul ebp,[left_col],6*65536
 
.next_line:
 
push ecx ebx
 
mov ecx,ebx
shl ecx,16
mov cl,10
mov ebx,[p_info.x_size]
add ebx,(OLEFT-1)*65536-10-SCRLW ; <OLEFT-1,LINE_WIDTH*6+2>
mcall 13,,,[color_tbl+4*5]
 
xor ecx,ecx
lodsd
mov [cur_line_len],eax
 
or eax,eax
ja .next_block
add esp,4*2
jmp .draw_cursor
 
.next_block:
 
push esi
push ecx
call get_next_part
pop ebx
push ecx
mov ecx,eax
 
push esi ebx
mov eax,ebx
sub ebx,[left_col]
cmp ebx,[scolumns]
jge @f
add ebx,esi
jle @f
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx
sub eax,[left_col]
jge .qqq
sub edx,eax
add esi,eax
mov eax,OLEFT*65536
jmp .qqq2
.qqq:
inc eax
imul eax,6*65536
.qqq2:
and ebx,0x0000FFFF
add ebx,eax
 
mov eax,[esp]
add eax,[esp+4];esi
sub eax,[left_col]
sub eax,[scolumns]
jle .qweqwe
sub esi,eax
.qweqwe:
 
mcall 4;[esp+8]
@@:
pop eax eax ; ebx esi
imul eax,6
add [esp+10],ax
pop ecx esi
cmp ecx,[cur_line_len];LINE_WIDTH
jl .next_block
 
pop ebx ecx
and ebx,0x0000FFFF
add ebx,OLEFT*65536+10
add esi,[cur_line_len];LINE_WIDTH
dec ecx
jg .next_line
 
;--------------------------------------------------------------------------
.draw_cursor:
mov eax,[posy]
sub eax,[top_line]
js @f
mov ecx,[slines]
sub ecx,eax
jle @f
imul eax,10
add eax,[top_ofs]
inc eax
shl eax,16
add eax,10-1
mov ecx,eax
mov ebx,[posx]
sub ebx,[left_col]
js @f
cmp ebx,[scolumns]
ja @f
imul ebx,6
add ebx,OLEFT-1
shl ebx,16
inc ebx
inc ebx
mov edx,[color_tbl+4*5]
not edx
and edx,0x00FFFFFF
mcall 13
@@:
;--------------------------------------------------------------------------
cmp [do_not_draw],2
je .exit
 
mov ebx,[p_info.x_size]
shl ebx,16
add ebx,(-SCRLW-5+2)*65536+SCRLW-2
mov ecx,[top_ofs-2]
mov cx,SCRLW-1
mcall 8,,,'UP',[sc.work_button]
pushad
push 0x18
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-3)*65536+SCRLW/2-4
mcall 4,,[sc.work_button_text],esp,1
add esp,4
popad
mov ecx,[bot_ofs]
shl ecx,16
add ecx,(-SCRLW*2-1)*65536+SCRLW-1
mcall ,,,'DN'
pushad
push 0x19
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-3)*65536+SCRLW/2-4
mcall 4,,[sc.work_button_text],esp,1
add esp,4
popad
sub ebx,1*65536-2
 
push ebx
mov eax,[lines]
mov ebx,[slines]
mov ecx,[top_line]
mov edx,[bot_ofs]
sub edx,[top_ofs]
add edx,-(SCRLW*3+2)
call get_scroll_vars
mov [vscrl_top],eax
mov [vscrl_size],ebx
pop ebx
 
mov ecx,eax
add ecx,[top_ofs]
shl ecx,16
mov cx,word[vscrl_size]
add ecx,(SCRLW+1)*65536
mcall 13,,,[sc.work_button]
mov ecx,[top_ofs-2]
mov cx,word[vscrl_top]
add ecx,(SCRLW+1)*65536
mov edx,[color_tbl+4*5]
or cx,cx
jle @f
mcall
@@:
mov ecx,[top_ofs]
add ecx,[vscrl_top]
add ecx,[vscrl_size]
add ecx,SCRLW+1
mov di,cx
shl ecx,16
mov cx,word[bot_ofs]
sub cx,di
sub cx,(SCRLW+1)*2
jle @f
mcall
@@:
;-------------------------------
@^
pushad
mov eax,ebx
shr eax,16
mov bx,ax
add ebx,0x00010001
mov ecx,[top_ofs]
add ecx,[vscrl_top]
add ecx,SCRLW+1
mov eax,ecx
shl ecx,16
add eax,[vscrl_size]
dec eax
add ecx,eax
mov edx,[sc.work_button]
add edx,0x00202020
mcall 38
add ebx,(SCRLW-2)*65536+(SCRLW-2)
mov edx,[sc.work_button]
sub edx,0x00202020
mcall 38
sub ebx,(SCRLW-2)*65536
mov ax,cx
shl ecx,16
mov cx,ax
mcall 38
mov eax,[vscrl_size-2]
mov ax,word[vscrl_size]
sub eax,0x00010001
sub ecx,eax
mov edx,[sc.work_button]
add edx,0x00202020
mcall 38
popad
^@
;-------------------------------
mov eax,ebx
shr eax,16
add bx,ax
mov ecx,[top_ofs-2]
mov cx,word[top_ofs]
add ecx,SCRLW*65536+SCRLW
mcall 38,,,[sc.work_text]
mov ecx,[bot_ofs-2]
mov cx,word[bot_ofs]
sub ecx,(SCRLW*2+2)*65536+(SCRLW*2+2)
mcall
rol ebx,16
push bx
rol ebx,16
pop bx
mov ecx,[top_ofs-2]
mov cx,word[bot_ofs]
add ecx,-2
mcall
;--------------------------------------------------------------------------
mov ebx,5*65536+SCRLW-1
mov ecx,[bot_ofs]
shl ecx,16
add ecx,(-SCRLW)*65536+SCRLW-2
mcall 8,,,'LT',[sc.work_button]
pushad
push 0x1B
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-3)*65536+SCRLW/2-4
mcall 4,,[sc.work_button_text],esp,1
add esp,4
popad
mov ebx,[p_info.x_size]
shl ebx,16
add ebx,(-SCRLW*2-5)*65536+SCRLW
mcall ,,,'RT'
pushad
push 0x1A
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-4
mcall 4,,[sc.work_button_text],esp,1
add esp,4
popad
inc ecx
 
push ecx
mov eax,[columns]
mov ebx,[scolumns]
mov ecx,[left_col]
mov edx,[p_info.x_size]
add edx,-(SCRLW*3+10)
call get_scroll_vars
mov [hscrl_top],eax
mov [hscrl_size],ebx
pop ecx
 
mov ebx,eax
add ebx,OLEFT+SCRLW
shl ebx,16
mov bx,word[hscrl_size]
mcall 13,,,[sc.work_button]
mov ebx,(OLEFT+SCRLW)*65536
mov bx,word[hscrl_top]
mcall ,,,[color_tbl+4*5]
mov ebx,OLEFT+SCRLW-1
add ebx,[hscrl_top]
add ebx,[hscrl_size]
mov di,bx
shl ebx,16
mov bx,word[p_info.x_size]
sub bx,di
sub bx,SCRLW*2+6
jle @f
mcall
@@:
mov eax,ebx
shr eax,16
add bx,ax
mov ecx,[bot_ofs-2]
mov cx,word[bot_ofs]
sub ecx,SCRLW*65536+2
mcall 38,<OLEFT+SCRLW-1,OLEFT+SCRLW-1>,,[sc.work_text]
mov ebx,[p_info.x_size-2]
mov bx,word[p_info.x_size]
sub ebx,(SCRLW*2+6)*65536+(SCRLW*2+6)
mcall
mov ebx,[p_info.x_size]
add ebx,5*65536-5
mov ecx,[bot_ofs-2]
mov cx,word[bot_ofs]
sub ecx,(SCRLW+1)*65536+(SCRLW+1)
mcall
;--------------------------------------------------------------------------
 
.exit:
popad
ret
endf
 
;--------------------------------------------
func get_scroll_vars
;--------------------------------------------
; Input:
; EAX = maximum data size (units)
; EBX = visible data size (units)
; ECX = current data position (units)
; EDX = scrolling area size (pixels)
; Output:
; EAX = srcoller offset (pixels)
; EBX = scroller size (pixels)
;--------------------------------------------
push eax ebx ecx edx
; sub eax,ebx
mov esi,eax
mov eax,edx
mul ebx
idiv esi
cmp eax,[esp]
jae .null
cmp eax,AMINS
jae @f
neg eax
add eax,AMINS
sub [esp],eax
mov eax,AMINS
@@: mov [esp+8],eax ; scroller size
mov eax,[esp]
mul ecx
idiv esi
mov [esp+12],eax ; scroller offset
add eax,[esp+8]
cmp eax,[esp]
jbe @f
dec dword[esp+12]
@@:
pop edx ecx ebx eax
ret
.null:
mov dword[esp+8],0
mov dword[esp+12],0
jmp @b
endf
 
;--------------------------------------------
func get_next_part
;--------------------------------------------
; Input:
; ECX = current letter
; ESI = string
; Output:
; ECX = color
; EDX = string
; ESI = length
;--------------------------------------------
cmp [asm_mode],0
je .plain.text
xor ebx,ebx
mov edx,ecx
add esi,ecx
mov edi,symbols
mov al,[esi]
cmp al,';'
je .comment
mov ecx,symbols.size
repne scasb
je .symbol
cmp al,'$'
jne @f
mov edi,symbols
mov al,[esi+1]
mov ecx,symbols.size
repne scasb
je .not_symbol
jmp .number
@@: cmp al,'0'
jb @f
cmp al,'9'
jbe .number
@@: cmp al,"'"
je .string
cmp al,'"'
je .string
.not_symbol:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
mov edi,symbols
mov al,[esi+ebx]
cmp al,';'
je @f
mov ecx,symbols.size
repne scasb
jne .not_symbol
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*0]
ret
.symbol:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
mov edi,symbols
mov al,[esi+ebx]
mov ecx,symbols.size
repne scasb
je .symbol
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*4]
ret
.comment:
neg edx
add edx,[cur_line_len];LINE_WIDTH
xchg edx,esi
mov ecx,[cur_line_len];LINE_WIDTH
mov eax,[color_tbl+4*3]
ret
.number:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
mov edi,symbols
mov al,[esi+ebx]
cmp al,';'
je @f
mov ecx,symbols.size
repne scasb
jne .number
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*1]
ret
.string:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
cmp [esi+ebx],al
jne .string
inc ebx
inc edx
@@:
mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*2]
ret
.plain.text:
mov edx,[cur_line_len];LINE_WIDTH
xchg edx,esi
mov ecx,[cur_line_len];LINE_WIDTH
mov eax,[color_tbl+4*0]
ret
endf
 
; ********************************************
; **************** SAVEFILE ****************
; ********************************************
func save_file
mov esi,0x80000 ; 0x70000 = 448 Kbytes (maximum)
mov edi,0x10000
 
.new_string:
call save_string
cmp dword[esi],0
jne .new_string
sub edi,0x10000+2 ; minus last CRLF
;! mov [filelen],edi
cmp byte[s_fname],'/'
je .systree_save
mcall 33,s_fname,0x10000,edi,0;[filelen],0
test eax,eax
je .exit
call file_not_found
jmp .exit
 
.systree_save:
;! mov eax,[filelen]
mov [f_info+8],edi ;! eax
mov [f_info+0],1
mov esi,s_fname
mov edi,f_info.path
mov ecx,PATHL
cld
rep movsb
mcall 58,f_info
 
.exit:
ret
endf
 
func save_string
lodsd
mov ecx,eax
 
@@: cmp byte[esi+ecx-1],' '
jne @f
loop @b
@@: jecxz .endcopy
xor edx,edx
mov ebx,edx
mov ah,dl
 
.next_char:
mov al,[esi+ebx]
inc ebx
test ah,00000001b
jnz .char
cmp al,'"'
jne @f
xor ah,00000100b
jmp .char
@@: cmp al,"'"
jne @f
xor ah,00000010b
jmp .char
@@: test ah,00000110b
jnz .char
cmp al,';'
jne @f
test ah,00000001b
jnz .char
xor ah,00000001b
jmp .char
@@: cmp al,' '
jne .char
inc edx
test ebx,ATABW-1
jnz @f
dec edx
jle .put
mov al,9
xor edx,edx
jmp .put
.char:
or edx,edx
jz .put
push ecx eax
mov ecx,edx
mov al,' '
rep stosb
pop eax ecx
xor edx,edx
.put:
stosb
@@: loop .next_char
 
.endcopy:
mov eax,0x0A0D
stosw
add esi,[esi-4]
ret
endf
 
; ********************************************
; **************** LOADFILE ****************
; ********************************************
 
func loadhdfile
mov [f_info+0],0
mov [f_info+8],300000/512
mov esi,s_fname
mov edi,f_info.path;pathfile_read
mov ecx,PATHL
cld
rep movsb
mcall 58,f_info ; fileinfo_read
xchg eax,ebx
inc eax
test ebx,ebx
je file_found
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
je file_found
call file_not_found
ret
endf
 
func loadfile
mcall 6,s_fname,0,16800,0x10000 ; 6 = open file
inc eax ; eax = -1 -> file not found
jnz file_found
call file_not_found
ret
 
file_found:
dec eax
mov [filesize],eax
mov [lines],1
mov [columns],0
mov esi,0x10000
mov edi,0x80000
mov edx,eax
 
.next_line:
mov ebx,edi
add edi,4
.next_char:
or edx,edx
jle .exit
lodsb
dec edx
cmp al,13
je .CR
cmp al,10
je .LF
cmp al,9
je .TB
cmp al,0
je .exit
stosb
jmp .next_char
 
.exit:
mov ecx,10
mov al,' '
rep stosb
lea eax,[edi-4]
sub eax,ebx
mov [ebx],eax
mov dword[ebx+eax+4],0
sub eax,10
jnz @f
inc eax
@@: cmp eax,[columns]
jbe @f
mov [columns],eax
@@: ret
 
.CR: cmp byte[esi],10
jne .LF
lodsb
dec edx
.LF: mov ecx,10
mov al,' '
rep stosb
lea eax,[edi-4]
sub eax,ebx
mov [ebx],eax
inc [lines]
add eax,-10
cmp eax,[columns]
jbe .next_line
mov [columns],eax
jmp .next_line
 
.TB: lea eax,[edi-4]
sub eax,ebx
mov ecx,eax
add ecx,ATABW
and ecx,not(ATABW-1)
sub ecx,eax
mov al,' '
rep stosb
jmp .next_char
 
file_not_found:
mcall 55,eax,error_beep ; beep
mov [lines],1 ; open empty document
mov [columns],1
xor eax,eax
mov [top_line],eax
mov [posx],eax
mov [posy],eax
mov edi,0x80000+4
mov ecx,10
mov [edi-4],ecx
mov [edi+10],eax
mov al,' '
cld
rep stosb
ret
endf
 
; *****************************
; ****** WRITE POSITION ******
; *****************************
 
func writepos
cmp [do_not_draw],1 ; return if drawing is not permitted
jae .exit
pusha
mov eax,[posx]
inc eax
mov ebx,5
mov ecx,10
mov edi,htext2.pos1
cld
call uint2strz
mov eax,[posy]
inc eax
mov ebx,5
mov edi,htext2.pos2
call uint2strz
mov eax,[lines] ; number of lines
mov ebx,5
mov edi,htext2.pos3
call uint2strz
mov ebx,5*65536+htext2.size*6
mov ecx,[bot_ofs]
shl ecx,16
add ecx,ABTNH
mcall 13,,,[sc.work_graph] ; draw bar
mov ebx,12*65536
mov bx,word[bot_ofs]
add ebx,(ABTNH+2)/2-4
mcall 4,,[sc.work_button_text],htext2,htext2.size ; write position
popa
 
.exit:
ret
endf
 
;-----------------------------------------------------------------------------
func uint2strz ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
dec ebx
jz @f
xor edx,edx
div ecx
push edx
call uint2strz
pop eax
@@: cmp al,10
sbb al,$69
das
stosb
ret
endf
 
; ****************************
; ******* READ STRING ********
; ****************************
 
func read_string
cmp al,5
jz .f1
cmp al,51
jz .f2
ret
 
.f1: mov [addr],s_fname
mov eax,[bot_ofs]
add eax,ABTNH+2
mov [ya],eax
push 0 ; case insensitive
jmp .rk
.f2: mov [addr],s_search
mov eax,[bot_ofs]
add eax,(ABTNH+2)*2
mov [ya],eax
push 1 ; case sensitive
.rk:
mov edi,[addr]
mov ecx,PATHL
sub ecx,[edi-4]
add edi,[edi-4]
mov al,$1C
cld
rep stosb
 
mov edi,[addr]
mov eax,[edi-4]
mov [temp],eax
add edi,eax
call print_text
mcall 40,00000111b
 
.waitev:
 
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 .waitev
dec [temp]
mov eax,[addr]
dec dword[eax-4]
sub edi,1
mov byte[edi],$1C
call print_text
jmp .waitev
.nobs:
movzx ebx,al
sub ebx,$20
jle .waitev
cmp byte[esp],0
jne .keyok
sub ebx,$40
jl .keyok
add al,[ebx+add_table]
.keyok:
mov ecx,[addr]
add ecx,PATHL
cmp edi,ecx
jae .waitev
mov [edi],al
inc [temp]
mov eax,[addr]
inc dword[eax-4]
 
call print_text
inc edi
jmp .waitev
 
.read_done:
add esp,4
mov ecx,PATHL
sub ecx,[temp]
mov edi,[addr]
add edi,[temp]
mov al,' '
cld
rep stosb
mov [temp],987
call print_text
mcall 40,00100111b
ret
endf
 
func print_text
pusha
mov ebx,(LBTNW+5+2)*65536
mov bx,word[p_info.x_size]
sub bx,LBTNW+RBTNW+10+3
mov ecx,[ya-2]
mov cx,ABTNH+1
mcall 13,,,[sc.work]
mov ebx,(LBTNW+5+2+4)*65536+ABTNH/2-3
add ebx,[ya]
mov eax,[p_info.x_size]
sub eax,LBTNW+RBTNW+10+8
push eax
cdq
mov ecx,6
div ecx
cmp eax,PATHL
jbe @f
mov eax,PATHL
@@: mov esi,eax
mcall 4,,[color_tbl+0],[addr]
 
mov eax,[ya]
mov ebx,eax
add eax,ABTNH/2-6
shl eax,16
add eax,ebx
add eax,ABTNH/2-6+11
mov ecx,eax
imul eax,[temp],6
pop ebx
cmp eax,ebx
jae @f
add eax,LBTNW+5+2+4
mov ebx,eax
shl eax,16
add ebx,eax
mcall 38,,,[color_tbl+0]
 
@@: popa
ret
endf
 
include 'helpwnd.asm'
 
;-----------------------------------------------------------------------------
section @DATA ;///////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
 
addr dd s_fname ; address of input string
temp dd 0xabc ; used in read_string
vscrl_capt dd -1
hscrl_capt dd -1
 
label color_tbl dword
dd 0x00000000 ;0x00FFFF00 ; text
dd 0x00009000 ;0x0000FF00 ; numbers
dd 0x00A00000 ;0x0000FFFF ; strings
dd 0x00909090 ;0x00C0C0C0 ; comments
dd 0x003030f0 ;0x00FFFFFF ; symbols
dd 0x00E0E0E0 ;0x00000080 ; background
 
add_table:
; times $61 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
 
error_beep db 0xA0,0x30,0
 
sz s_example,'README.TXT'
sz s_still ,'still'
 
;sz param_setup,<'LANG',0> ; parameter for SETUP
param_setup db 'LANG',0
 
sz fasm_filename ,'FASM '
sz debug_filename ,'BOARD '
sz tinypad_filename,'TINYPAD '
sz setup ,'SETUP ' ; to change keyboard layout
 
lsz sysfuncs_filename,\
ru,<'SYSFUNCR.TXT',0>,\
en,<'SYSFUNCS.TXT',0>
 
sz htext,'TINYPAD'
sz toolbar_btn_text,'COMPILE RUN BOARD SYSFUNC'
 
lsz lstr,\
ru,<' ”€‰‹ > ',' ‘’ŽŠ€ > '>,\
en,<' FILE > ',' STRING > '>
lsz rstr,\
ru,<' ‘Ž•€ˆ’œ ',' ‡€ƒ“‡ˆ’œ ',' Žˆ‘Š '>,\
en,<' SAVE ' ,' LOAD ' ,' SEARCH ' >
 
lsz htext2,\
ru,'Ž‡ˆ–ˆŸ 00000:00000 „‹ˆ€ 00000 ‘’ŽŠ',\
en,'POSITION 00000:00000 LENGTH 00000 LINES'
if lang eq ru
htext2.pos1 = htext2+8
htext2.pos2 = htext2+14
htext2.pos3 = htext2+28
else
htext2.pos1 = htext2+9
htext2.pos2 = htext2+15
htext2.pos3 = htext2+30
end if
 
lszc help_text,b,\
ru,'ŠŽŒ€„›:',\
ru,' ',\
ru,' CTRL+F1 : â® ®ª­®',\
ru,' CTRL+S : ¥à¢ ï áâப  ¤«ï ª®¯¨à®¢ ­¨ï',\
ru,' CTRL+E : ®á«¥¤­ïï áâப  ¤«ï ª®¯¨à®¢ ­¨ï',\
ru,' CTRL+P : ‚áâ ¢¨âì ¢ë¡à ­­®¥ ­  ⥪ãéãî ¯®§¨æ¨î',\
ru,' CTRL+D : “¤ «¨âì áâபã',\
ru,' CTRL+L : ‚áâ ¢¨âì áâபã-à §¤¥«¨â¥«ì',\
ru,' CTRL+[ : ¥à¥©â¨ ¢ ­ ç «® ä ©« ',\
ru,' CTRL+] : ¥à¥©â¨ ¢ ª®­¥æ ä ©« ',\
ru,' CTRL+F2 : ‡ £à㧨âì ä ©«',\
ru,' CTRL+F3 : ®¨áª',\
ru,' CTRL+F4 : ‘®åà ­¨âì ä ©«',\
ru,' CTRL+F5 : ‚¢¥á⨠¨¬ï ä ©« ',\
ru,' CTRL+F6 : ‚¢¥á⨠áâப㠤«ï ¯®¨áª ',\
ru,' CTRL+F8 : ‘¬¥­¨âì à áª« ¤ªã ª« ¢¨ âãàë',\
ru,'',\
en,'COMMANDS:',\
en,' ',\
en,' CTRL+F1 : SHOW THIS WINDOW',\
en,' CTRL+S : SELECT FIRST STRING TO COPY',\
en,' CTRL+E : SELECT LAST STRING TO COPY',\
en,' CTRL+P : PASTE SELECTED TO CURRENT POSITION',\
en,' CTRL+D : DELETE CURRENT LINE',\
en,' CTRL+L : INSERT SEPARATOR LINE',\
en,' CTRL+[ : GO TO THE BEGINNING OF FILE',\
en,' CTRL+] : GO TO THE END OF FILE',\
en,' CTRL+F2 : LOAD FILE',\
en,' CTRL+F3 : SEARCH',\
en,' CTRL+F4 : SAVE FILE',\
en,' CTRL+F5 : ENTER FILENAME',\
en,' CTRL+F6 : ENTER SEARCH STRING',\
en,' CTRL+F8 : CHANGE KEYBOARD LAYOUT',\
en,''
 
lsz help_title,\
ru,'ŽŒŽ™œ',\
en,'TINYPAD HELP'
 
sz symbols,'#&*\:/<>|{}()[]=+-, '; %.'
 
align 4
label f_info dword
dd ?
dd 0
dd ?
dd 0x10000
dd 0x70000
.path:
times PATHL+1 db ?
 
TINYPAD_END: ; end of file
 
;-----------------------------------------------------------------------------
section @UDATA ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
 
posx dd ? ; global X position (text cursor)
posy dd ? ; global Y position (text cursor)
lines dd ? ; number of lines in file
slines dd ? ; number of lines on the screen
columns dd ? ; number of columns in file
scolumns dd ? ; number of columns on the screen
top_ofs dd ? ; height occupied by top buttons
bot_ofs dd ? ; height occupied by bottom buttons
top_line dd ? ; topmost visible line on screen
left_col dd ? ; leftmost visible char on line
vscrl_top dd ?
vscrl_size dd ?
hscrl_top dd ?
hscrl_size dd ?
skinh dd ? ; skin height
__rc dd ?,?,?,?
;filelen dd ? ; file size (on save) ???
filesize dd ? ; file size (on load) ???
ya dd ? ; for read_string
copy_start dd ? ; first line for copying (Ctrl+S)
copy_count dd ? ; number of lines for copying (Ctrl+E)
copy_size dd ? ; size of data to copy
s_title.size dd ? ; caption length
 
cur_line_len dd ?
 
asm_mode db ? ; ASM highlight?
do_not_draw db ? ; draw top and bottom buttons?
main_closed db ? ; main window closed? (to close help window)
 
align 4
s_fname.size dd ?
s_fname rb PATHL+1
align 4
s_search.size dd ?
s_search rb PATHL+1
 
s_title rb 256 ; window caption
 
;-----------------------------------------------------------------------------
section @PARAMS ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
 
fasm_parameters:
 
p_info process_information
sc system_colors
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad2/trunk/ReadMe.txt
0,0 → 1,203
-= [v 3.78b] =-
‚¥àá¨ï ¡ë«  ᤥ« ­  áࠧ㠯®á«¥ ⮣® ª ª ï ¢ë«®¦¨« ¯à¥¤., ­® ï ¥ñ ­¥ ¢ëª« ¤ë¢ «,
â ª ª ª ­ ¤¥ï«áï ¥éñ ¤®à ¡®â âì.
 
®¢®¥:
- ¯®¨áª á¯àïâ ­ ¢ ¬¥­î, £®àïç ï ª« ¢¨è  ctrl+F7, ¯®¨áª ¤ «¥¥ - ctrl+F8
- ¡®«¥¥ ¤«¨­­ ï áâப  ®âªàëâ¨ï ä ©«®¢, ­¥ ¦¥« â¥«ì­® ®âªà뢠âì ¯ãâ¨
>71 ᨬ¢®« , â ª ª ª ¬®£ãâ ¢®§­¨ª­ãâì ®è¨¡ª¨ ¯à¨ à ¡®â¥ á ®ª­®¬ "¡ëáâண® á/§"
 
 
íâ® ¯à®áâ® ¤®¯®«­¥­¨¥ ª ¯à¥¤ë¤ã饬㠢ë¯ãáªã. ¤ «ìè¥ ¡ã¤¥â ¨á¯à ¢«¥­®:
- £«îª á ­¥ ªâ¨¢­ë¬¨ ®ª­ ¬¨.
 
-= [v 3.78a] =-
 
‚த¥ à ¡®â ¥â.. :)
 
®¢®¥:
- ‘ªà®«« ¢§ïâ á "Scroll.inc", ¢â®à ª®â®à®£® Jason Delozier.
¯à¨­æ¨¯ ¤¢¨¦¥­¨ï ¯® ¤®ªã¬¥­âã ¯®«­®áâìî ¨§¬¥­ñ­ (¯® áà ¢­¥­¨î
á ¯à®è«®© ¢¥àᨥ©).
- Šãàá®à ¤¢¨£ ¥âáï ª«¨ª®¬ ¬ë誨.
- „®¡ ¢«¥­  äã­ªæ¨ï Goto Line #.
(enter-goto; esc - cancel)
¤®áâ â®ç­® ¯®«¥§­ ï äã­ªæ¨ï, ª®£¤  ä á¬(­  ¤®áª¥ ®â« ¤ª¨) ¯¨è¥â çâ® ®è¨¡ª 
¢ â ª®©-â® áâப¥...
- ˆá¯à ¢«¥­ ¡ £ á § ¤ ­¨¥¬ ¨¬¥­¨ ­®¢®£® ä ©« 
- ˆá¯à ¢«¥­ ¡ £ á® áâப®© ¯®¨áª  (¯à¨ "¯®¨áª¥" ¯®á«¥¤­¥© áâப¨)
- ˆá¯à ¢«¥­ ¡ £ ¯®á«¥ ¢ë§®¢  ¤¨ «®£®¢ ®âªàëâ¨ï/á®åà ­¥­¨ï.
⥯¥àì áªà®«« ¯®á«¥ ­¨å ¯à®¤®«¦ ¥â à ¡®â âì ;)
- Œ¥«ª¨¥ ¨á¯à ¢«¥­¨ï ¢ à ¡®â¥ ¬¥­î.
 
®ï¢¨«áï:
£«îª, ª ª ¢ LC - ¯à¨ ­ ¦ â¨¨ ¢ ®¡« á⨠®ª­ , ¤ ¦¥ ¥á«¨ ®ª­® ­¥  ªâ¨¢­®,
ªãàᮢ ¨ áªà®«« ¡ à ¢áñ à ¢­® ॠ£¨àãîâ ­  ¬ëèªã.
 
 ¡®â î ­ ¤:
-ᯨ᪮¬ ¯®á«¥¤­¨å ä ©«®¢
-§ £à㧪®© "color table'a"
 
â ª ¦¥, ­ ¤® ¯®á¬®âà¥âì ¨á室­¨ª¨ HeEd'a,   â®ç­¥¥ ä㭪樨 ¯¥à¥ª®¤¨à®¢ª¨.
 
-------------------------------------------------
 
-= [v 3.77a] =-
 
…éñ ®¤­   «ìä .
 
  íâ®â à §:
- ¤®¡ ¢«¥­  ¯®«®á  ¯à®ªã⪨
- ¨á¯à ¢«¥­® ®ª­® ¢®¯à®á  "á®åà ­¨âì ¤®ªã¬¥­â", â ª ª ª ï § ¬¥â¨«
çâ® ®­® ¦à «® ¬­®£® ¯à®æ¥áá®à­®£® ¢à¥¬¥­¨.
- ®¡­®¢«¥­¨¥ íªà ­  ¯®á«¥ ¤¨ «®£®¢ á®åà ­¥­¨ï ¨ ®âªàëâ¨ï
 
  § ¬¥âªã: áªà®«« ¯®«­®áâìî ᤥ« ­ ¬­®© ¨ ¯®í⮬ã, ¢®§¬®¦­®, ¥áâì £«îª¨.
â ª ª ª ï ­¥ ­ èñ« ¡®«¥¥ å®à®è¥© ä®à¬ã«ë, áªà®«« ¢á¥£¤  ­¥¬­®£® ­¥ ¤®¥§¦ ¥â ¤®
¢¥àå , § â® ­¨ª®£¤  ­¥ ¯¥à¥á¥ª ¥â ­¨¦­îî ª­®¯ªã (¢à®¤¥ ¡ë)
 
ª­®¯ª¨ áªà®««  "¢¢¥àå" ¨ "¢­¨§" íª¢¨¢ «¥­â­ë pg.up ¨ pg.down
 
 §¬¥à áªà®««  ¦¥á⪮ § ªà¥¯«ñ­, â ª ª ª ᪮஠¡ã¤¥â § ¯¥à饭®
¨§¬¥­ïâì à §¬¥­ë ®ª­ .
 
 
¥ ¯®«ãç¨âáï:
“¡à âì ®£à ­¨ç¥­¨¥ ¢ 80 ᨬ¢®«®¢ ¨ ¯à¨á®¡ ç¨âì ¯®¤¤¥à¦ªã BGI èà¨ä⮢.
à®¡«¥¬  ¢ ᫨誮¬ ¨§¢à éñ­­®¬  «£®à¨â¬¥ ¢ë¢®¤  ᨬ¢®«®¢ (¯® ªà ©­¥©
¬¥à¥ ¬­¥ â ª ¯®ª § «®áì), ¯à®é¥ ¡ã¤¥â ¯¥à¥¤¥« âì ¢áñ ¯® ­®¢®©,
¢§ï¢ ­¥ª®â®àë¥ ä㭪樨 ®âá.
 
‚ á«¥¤ãî饩 ¢¥àᨨ ¯« ­¨àã¥âáï:
- äã­ªæ¨ï "goto string #"
- ¨§¬¥­¥­¨¥ æ¢¥â  â¥ªáâ  (¨ ᯥæ. ᨬ¢®«®¢) ¨ à ¡®ç¥© ®¡« áâ¨.
- á®åà ­¥­¨¥ ­¥¡®«ì讣® ᯨ᪠ "¯®á«¥¤­¨å । ªâ¨à㥬ëå ä ©«®¢"
¯®áâ à îáì, ­® ¢áñ ¦¥ ­¨ç¥£® ­¥ ®¡¥é î....
 
 
-= [v 3.76 ] =-
 
®¢â®à­ë© ६¥©ª â ©­¨¯ ¤  :) Š« ¢¨ âãà  à㫨â.
 
—â® ­®¢®£®?
 
- "Žª­® ¡ëáâண® á®åà ­¥­¨ï ¨ § £à㧪¨" ¤«ï ¯à®¯¨á뢠­¨ï ¯ãâ¨
ª ä ©«ã "¢àãç­ãî". ‚ í⮬ ¦¥ ®ª­¥ £®àï稥 ª« ¢¨è¨ -
ctrl+s - á®åà ­¨âì, ctrl+o - ®âªàëâì, esc - ®â¬¥­ 
 
- ƒ®àï稥 ª« ¢¨è¨ ¤«ï ª®¬¯¨«ï樨(CTRL+F9),
ª®¬¯¨«ï樨 ¨ § ¯ã᪠ (CTRL+F10), ¨ ¤®áª¨ ®â« ¤ª¨(F12)
 
- £« ¢­®¥ ®ª­® ®áâ ñâáï  ªâ¨¢­ë¬ ¯®á«¥ § ¯ã᪠ ¤®áª¨ ®â« ¤ª¨
¨ ®ª­  ¡ëáâண® á®åà ­¥­¨ï (⮫쪮 £®àï稬¨ ª« ¢¨è ¬¨)
 
- ˆá¯à ¢«¥­ £«îª ¢ë«¥â ­¨ï ¯à¨ ¯®¯ë⪥ ¯®¨áª  ¢ ¯ãá⮬
¤®ªã¬¥­â¥
 
- ®¡« £®à®¦¥­ ¯¨áª ¨§ ᯨª¥à , ⥯¥àì ¯®å®¦ ­  ¯¨áª Š®«¨¡à¨ 3
 
- Š­®¯ª¨ ¢ë஢­¥­ë ¤«ï ¨á¯®«ì§®¢ ­¨ï ᪨­ 
 
- ¯® ­¥¯®­ïâ­ë¬ ¬­¥ ¯à¨ç¨­ ¬ ä ©«ë á®åà ­ñ­­ë¥ ¢ ­¨¦­¥¬ ॣ¨áâà¥
 ¡á®«îâ­® ­¥ ¯à¨­¨¬ «¨áì sysxtree ¨ ­ã¦­® ¡ë«® ¨å ®âªà뢠âì
¢àãç­ãî ¯à®¯¨áë¢ ï ¯ãâì. ¨á¯à ¢«¥­® ®¡ëç­ë¬ ¯¥à¥¢®¤®¬ ¢ ¢¥àå­¨©
ॣ¨áâà.
 
- ®ª­  á®®¡é¥­¨ï ¯à¨ ¯¥à¥¯®«­¥­­®¬ ¤¨áª¥ (â  ¦¥ ¯à®æ¥¤ãà , çâ® ¨ ¤«ï erroff ã
savedialog)
 
- ¨á¯à ¢«¥­ ¬®© ¡ £ - ¯à¨ ­¥¢®§¬®¦­®á⨠á®åà ­¥­¨ï ⥯¥àì ®áâ ñâáï áâ àë© ¯ãâì
ª ä ©«ã (¨ ¨¬ï).
 
- ¨á¯à ¢«¥­® ¥éñ ¯ à®çª  ¬¥«ª¨å ­¥¤®çñ⮢ (¬®¨å?!).
 
—â® ­¥ ᤥ« ­®?
 
‚áñ ¥éñ ­¥â ¯®¤¤¥à¦ª¨ èà¨ä⮢ BGI ¨
¨§¬¥­¥­¨ï æ¢¥â  ä®­ /⥪áâ . •®âï ï ᮬ­¥¢ îáì, çâ® BGI èà¨äâë ¯àאַ "­¥®¡å®¤¨¬
ë"
¢  á¬-¡«®ª­®â¥.
®ª  ¥éñ ­¥ ®¡à ¡ â뢠¥âáï ®è¨¡ª  "fat12 § ¯®«­¥­" - ¢à®¤¥ ¡ë ¤ ¦¥ ä㭪樨 ¢ ï¤
ॠ­¥â...
•®çã ¯¥à¥©â¨ ­  ᪠­-ª®¤ë,   â® ¢  áª¨ ¯®¢â®àïîâáï ª®¤ë.
--------------------------------------------
¨ ¥éñ: ® ®è¨¡ª å ¨ ªà¨â¨ª¥ - ¬­¥ (­¥ "¬¥­ï") ­  ¬ë«® ¨«¨ ­  ä®àã¬.
--------------------------------------------
 
ˆáâ®à¨ï...
 
-= [ v 3.75b ] =-
 
Ž....
¥¬¥©ª :) Tinypad'a :
’ã«¡ à ⥯¥àì á¯àïâ ­ ¢ ¬¥­î. „«ï á®åà ­¥­¨ï ¨ ®âªàëâ¨ï ¨á¯®«ì§ãîâáï
¤¨ «®£¨ ¨§ ASCL  ¢«î設  …¢£¥­¨ï. ˆá¯à ¢«¥­ "¦ã⪨©" ¡ £ - ª®£¤ 
á®åà ­ï¥èì ¤®ªã¬¥­â ¯®¤ ¤à㣨¬ ¨¬¥­¥¬, ¢ áâப¥ § £®«®¢ª  ®áâ ¢ «®áì
áâ à®¥ ­ §¢ ­¨¥.
„®¡ ¢«¥­ë ¤¨ «®£®¢ë¥ ®ª­  ¯à¨ ®è¨¡ª å ¨ ¢ë室¥. „®¡ ¢«¥­  ª­®¯ª 
"­®¢ë©", ¯à¨ ­ ¦ â¨¨ ­  ª®â®àãî § ¤ ñâáï ¢®¯à®á ® á®åà ­¥­¨¨ ä ©« , § â¥¬
ᮧ¤ ñâáï ¤®ªã¬¥­â á ­®¢ë¬ ¨¬¥­¥¬. Œ ªá¨¬ «ì­® 99 ­®¢ëå ¤®ªã¬¥­â®¢. Š­®¯ª 
"­®¢®¥ ®ª­®" ®âªà뢠¥â ­®¢®¥ ®ª­® ’ ©­¨¯ ¤  (§ ¯ã᪠¥â ­®¢ë© ¯à®æ¥áá).
 
Ž £àãáâ­®¬...
Ž¡® ¢á¥å ®è¨¡ª å ¬­¥ ­  ¬ë«®, ¯®¯à®¡ãî ¨á¯à ¢¨âì.
„¨ «®£ "á®åà ­¨âì ª ª" á®åà ­ï¥â ⮫쪮 ­  £®â®¢ë¥ ä ©«ë (â® ¥áâì ¯®¢¥àå ­¨å,
­¥«ì§ï ᮧ¤ âì ­®¢ë©).
à¨ ¯®¯ë⪥ ¯®¨áª  áâப¨ ¢ ¯ãá⮬ ¤®ªã¬¥­â¥ ¯à®£  ¢ë«¥â ¥â :(
à¨ ¢ë室¥, ª®£¤  ¢ë« §¨â ®ª®èª® á ¢®¯à®á®¬ "á®åà ­¨âì ä ©«?" - ¤  - á®åà ­ï¥â
¤®ªã¬¥­â ¨ § ªà뢠¥â ®ª­®, ­¥â - ­¥ á®åà ­ï¥â ¨ ¢ë室¨â, ™¥«çñª ¯® à ¡®ç¥© ®¡« 
áâ¨
â ©­¨¯ ¤  íª¢¨¢ «¥­â¥­ ª­®¯ª¥ ®â¬¥­ , ª®â®à®© ­¥âã ;), ¯à ¢¤  ¥á«¨ ®ª­® á®®¡é¥­¨
ï
¯¥à¥¬¥áâ¨âì, £« ¢­®¥ ®ª­® ­¥ ®¡­®¢«ï¥âáï. â® ¢ë§¢ ­­® "ᯥæ¨ä¨ç¥áª¨¬" ª®¤®¬, â
 ª
ª ª ¡®«¥¥ ¯à®á⮣® à¥è¥­¨ï ï ­¥ ­ èñ«.
 
Ž ᯠᨡª å...
‚ᥬ ᯠᨡ !  ¢«î設㠧  ASCL, • «ï¢¨­ã, Willow ¨ ¢á¥¬ á ­ è¥£® ä®à㬠 ¯®¬®éì.
 
Ž ¡ã¤ã饬...
¥á«¨ ¯®«ãç¨âáï, ¬®¦­® ¡ã¤¥â ॠ«¨§®¢ âì ¯®¤¤¥à¦ªã BGI èà¨ä⮢... ¥éñ ­¥ ᬮâ५
¨å ª®¤ -- áâà è­®!
 
Šâ®, ¡«%?
DoomEd Archangel
archangel@mail.kz / meos-wall.narod.ru
 
 
 
-= [ v 3.75a ------> v 3.6 ] =-
 
;******************************************************************************
; project name: TINYPAD
; compiler: flat assmebler 1.52 alpha 3
; version: 3.75a
; last update: 24/03/2004
; maintained by: Ivan Poddubny
; e-mail: ivan-yar@bk.ru
;******************************************************************************
; HISTORY:
; 3.75a
; fixed converting char to upper case in read_string
; 3.75
; rewrote save_file from scratch; bugfix in loadfile;
; 3.74
; optimisation
; 3.73
; completly new load_file function
; 3.72
; speed++
; 3.71
; error beep
; 3.6,3.7:
; many bugs fixed
; simple toolbar
; compile, run applications from TINYPAD, all fasm output is in debug board
; TAB button
; auto-indent
; Ctrl+L - insert comment string
;******************************************************************************
; Memory 0x300000:
; stack 0x00eff0 - áâíª
; stack for help 0x00fff0 -
; stack for help 0x00fff0
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad2/trunk/archive.txt
0,0 → 1,8
„«ï ­ ç¨­ îé¨å à ¡®â âì á MeOS - ®¯¨á ­¨¥ ä ©«®¢ ¢ í⮬  à娢¥:
 
tinypad - ᪮¬¯¨«¨à®¢ ­­ë© ¨á¯®«­ï¥¬ë© ä ©« MeOS
tinypad.asm - ¨á室­ë© ª®¤
ascl.inc - assembler small code library ®â  ¢«î設  …¢£¥­¨ï
(äã­ªæ¨ï label § ¬¥­¥­  ­  putlabel)
dialogs1.inc - ¤¨ «®£®¢ë¥ ®ª­ , messagebox'ë ¨ ­¥ ®ç¥­ì å®à®è¥¥ ¬¥­î.
macros.inc - ⮦¥ § ¬¥ç â¥«ì­ë© ­ ¡®à ¬ ªà®á®¢.
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad2/trunk/ascl.inc
0,0 → 1,933
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 savefile file_name,file_save_area,file_temp_area,fsize
{
local save,fileinfo,string ;,counter00
jmp save
;counter00 dd 0
fileinfo:
dd 1
dd 0
dd fsize ;counter00
dd file_save_area
dd file_temp_area
string:
db file_name,0
save:
;xor edi,edi
; sub edi,file_save_area ; calculate dump size
; mov edx,edi
;mov [counter00],edi
; mov dword [fileinfo+8],1 ; how many blocks to write (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
words2reg ebx,arg1,arg3
words2reg ecx,arg2,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 putlabel 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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad2/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tinypad2.asm tinypad2
@pause
/programs/tinypad2/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tinypad2.asm tinypad2
@pause
/programs/tinypad2/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:
 
 
 
 
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad2/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad2/trunk/scroll.inc
0,0 → 1,440
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;
;; Scroll.inc ;
;; ;
;; Vertical Scroll Bar Example for MenuetOS ;
;; ;
;; Version 0.2 27 February 2005 ;
;; ;
;; ;
;; GNU GENERAL PUBLIC LICENSE ;
;; Version 2, June 1991 ;
;; ;
;; Copyright 2005 Jason Delozier, ;
;; cordata51@hotmail.com ;
;; ;
;; See file COPYING for details ;
;; ;
;; Updates: ;
;; - FPU not longer used for calculations -Feb 27, 2005 ;
;; ;
;; ;
;; TODO: ;
;; - Create Message Handler and only allow runtime arguments ;
;; to be processed through the message handler ;
;; - Remove all local varibles and only allow working varible to ;
;; reside in scroll bar structure. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
 
 
 
;*****************************************************************************
;*
;* VScroll Structure Equates
;*
;*****************************************************************************
 
VScroll_width equ 0
VScroll_x equ 2
VScroll_height equ 4
VScroll_y equ 6
VScroll_min equ 8
VScroll_max equ 12
VScroll_current equ 16
VScroll_s_change equ 20
VScroll_b_change equ 24
 
;Example VScroll Structure
;VScroll_1:
; dw 16 ;width +0
; dw 100 ;x +2
; dw 200 ;height +4
; dw 40 ;y +6
; dd 0 ;min +8
; dd 1000;max +12
; dd 1 ;current +16
; dd 1 ;small change +20
; dd 10 ;big change +24
 
VScroll_Min_Height dw 16 ;scroll box
Vscroll_Fixed_Height dw 16 ;height of scroll buttons (up and down)
 
;**************************************
;*
;* Mouse Over VScroll
;*
;**************************************
vsm1 dd 0
vstoff dd 0
 
VScroll_mouse_over:
cmp [mouseb], 1
je VScroll_Mouse_Has_Mouse
cmp [mouseb], 0
jne VScroll_mouse_over_done2
mov [vsm1], 0
jmp VScroll_mouse_over_done2
VScroll_Mouse_Has_Mouse:
push ecx
mov ecx, [vsm1]
shl ecx,2
call dword [VScroll_Mouse_Jumptable+ecx]
VScroll_mouse_over_done:
pop ecx
VScroll_mouse_over_done2:
ret
 
VScroll_Mouse_Jumptable:
dd VScroll_Mouse_Find
dd VScroll_Mouse_On_Up
dd VScroll_Mouse_On_Down
dd VScroll_Mouse_Above_Thumb
dd VScroll_Mouse_Below_Thumb
dd VScroll_Mouse_On_Thumb
 
VScroll_Mouse_Find:
inc ecx
call dword [VScroll_Mouse_Jumptable+ecx*4]
cmp [vsm1], 0
jne VScroll_mouse_over_done2
cmp ecx, 5
je VScroll_mouse_over_done2
jmp VScroll_Mouse_Find
 
 
;**************************************
;Is Mouse at Up button
VScroll_Mouse_On_Up:
push eax
movzx eax, word [ebp+VScroll_y]
add ax, word [Vscroll_Fixed_Height]
cmp [mousey], ax
pop eax
ja VScroll_Mouse_On_Up2
mov [vsm1], 1
call VScroll_Small_Up
VScroll_Mouse_On_Up2:
ret
 
;**************************************
;Is Mouse at Down button
VScroll_Mouse_On_Down:
push eax
movzx eax,word [ebp+VScroll_y]
add ax, word [ebp+VScroll_height]
sub ax, word [Vscroll_Fixed_Height]
cmp [mousey], ax
pop eax
jb VScroll_Mouse_On_Down2
mov [vsm1], 2
call VScroll_Small_Down
VScroll_Mouse_On_Down2:
ret
 
;**************************************
;Is Mouse above Scroll Thumb
VScroll_Mouse_Above_Thumb:
push eax
push ecx
push edx
call Vscroll_SBox_Area
add cx, word [ebp+VScroll_y]
add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button
cmp cx, [mousey]
pop edx
pop ecx
pop eax
jb VScroll_Mouse_Above_Thumb2
mov [vsm1], 3
call VScroll_Big_Up
VScroll_Mouse_Above_Thumb2:
ret
 
;**************************************
;Is Mouse below scroll thumb
VScroll_Mouse_Below_Thumb:
push eax
push ecx
push edx
call Vscroll_SBox_Area
add cx, word [ebp+VScroll_y]
add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button
add cx, ax
cmp cx, [mousey]
pop edx
pop ecx
pop eax
ja VScroll_Mouse_Below_Thumb2
mov [vsm1], 4
call VScroll_Big_Down
VScroll_Mouse_Below_Thumb2:
ret
 
;**************************************
;Mouse is on Scroll Thumb
VScroll_Mouse_On_Thumb:
 
pusha
cmp [vsm1], 5 ;first time moving since we clicked?
je VScroll_Mouse_On_Thumb1 ;if not jump.. we already have offset
mov [vsm1], 5 ;determine offset between mouse pointer and top of thumb
call Vscroll_SBox_Area ;get top of thumb coordinate
add cx, word [ebp+VScroll_y] ;make screen coordinate
add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button and top
movzx esi,word [mousey] ;get mouse position
sub esi, ecx ;make offset between top of thumb
mov [vstoff], esi ;and mouse pointer then save it
VScroll_Mouse_On_Thumb1: ;
movzx esi, [mousey] ;get mouse y value
sub si, word [ebp+VScroll_y] ;get y starting value of scroll bar
sub si, [Vscroll_Fixed_Height]
sub esi, [vstoff] ;
call Vscroll_SBox_Area ;
VScroll_Mouse_On_Thumb2: ;
cmp [ebp+VScroll_current], edx ;only redraw if change occured
je VScroll_Mouse_On_Thumb3 ;
mov [ebp+VScroll_current], edx ;new current value
call drawvscrolla ;redraw scroll background and thumb
VScroll_Mouse_On_Thumb3: ;
popa ;
ret
;**************************************
 
 
 
 
;*****************************************************************************
;*
;* Vscroll_SBox_Area
;*
;* Purpose: To determine the area of the Scroll Bar Thumb and the current
;* value of scroll based on top pixel of thumb.
;*
;* Inputs:
;* EBP - Structure of scroll bar
;* ESI - Top of Thumb - optional
;*
;* Outputs:
;* EAX - Thumb Height
;* ECX - Top of thumb
;* EDX - Current Value based on top pixel of thumb. Valid when ESI
;* is given as input.
;*
;* This procedure is divided up into 5 specific functions.
;* 1. ((Vmax-VMin)/Small Change)= Total Changes
;* 2. Height - (2* Fixed Button Height) = Total Pixels
;* 3. Total Pixels - Total Changes = Thumb Height (must be >= 16)
;* Minimum Height of 16 is varible [VScroll_Min_Height]
;* 4. (((Tot Pixels - Thumb Height)* Current)/Max-min)=Top Pixel of Thumb
;* 5. ((Mouse Top * (max-Min))/(Total Pix - Thumb Height)) = Current
;* Step 5 is only valid if ESI is supplied as an input.
;*
;*
;*****************************************************************************
 
Vscroll_SBox_Area:
push ebx
push esi
push edi
;Step 1. Determine Total Changes
mov eax, dword [ebp+VScroll_max] ;get max scroll
sub eax, dword [ebp+VScroll_min] ;sub minmum scroll for total scro
xor edx,edx
push eax
div dword [ebp+VScroll_s_change] ;
;eax = total changes ((max-min)/Small Change)
 
;Step 2. Determine Total Pixels
movzx ecx, word [ebp+VScroll_height] ;height of entire scroll bar
mov bx, word [Vscroll_Fixed_Height] ;minus height of both scroll button
shl bx, 1
sub cx, bx
push ecx
;ecx = total pixels (Total Height - (2*Fixed Button Height)
 
;Step 3. Determine Thumb Height
cmp ecx, eax
jbe vs1
sub ecx, eax
cmp cx, word [VScroll_Min_Height]
jb vs1
jmp vs2
vs1:
movzx ecx, word [VScroll_Min_Height]
vs2:
;ecx = Thumb Height (Total Pixels - Total Changes) >=16
 
;Step 4. Determine Top Pixel of Thumb
pop edi ;Total Pixels
sub edi, ecx ;
;edi = Total Pixels - thumb Height
mov eax, edi ;
mul dword [ebp+VScroll_current] ;get current scroll value
pop ebx ;max scroll
push ecx ;
div ebx ;
mov ecx, eax ;
;ecx = top pixel of thumb
 
;Step 5. Determine Current Value based on Mouse Position
cmp si,0
jge vss4
mov eax, dword [ebp+VScroll_min]
jmp vsdone1
vss4:
cmp esi, edi
jbe vss3
mov eax, dword [ebp+VScroll_max]
jmp vsdone1
vss3:
mov eax,ebx ;max scroll
mul esi ;Top Pixel of mouse
div edi ;Total Pixels - Thumb Height
;eax = Current Value
 
vsdone1:
mov edx, eax ;Current Value
pop eax ;Thumb Height
pop edi
pop esi
pop ebx
ret
 
;*****************************************************************************
;*
;*****************************************************************************
;ebp is structure
drawvscroll:
pusha
;up button
mov eax, 13 ;button system function
mov edx,0x00777777 ;0x6677cc ;color
mov ebx, [ebp+VScroll_width] ;x-start/width
mov cx, word [ebp+VScroll_y] ;get bottom of scroll bar
shl ecx, 16
mov cx, [Vscroll_Fixed_Height] ;fixed height
int 0x40
 
;down button
mov ebx, [ebp+VScroll_width] ;x-start/width
mov cx, word [ebp+VScroll_y] ;get bottom of scroll bar
add cx, word [ebp+VScroll_height] ;
sub cx, [Vscroll_Fixed_Height] ;y-start is 12 pixel from bottom
shl ecx, 16 ;
mov cx, [Vscroll_Fixed_Height] ;fixed height
int 0x40
;------- 'ASCL.INC' needs to be included to use this --
putlabel 493,46,'',cl_Black
putlabel 493,372,'',cl_Black
;------------------------------------------------------
 
popa
drawvscrolla:
pusha
 
mov eax, 13 ;Draw Scroll Box Background
mov edx, 0x00999999;0 ;color
push edx
movzx edx, word [Vscroll_Fixed_Height]
mov ebx, [ebp+VScroll_width] ;x-start/width
movzx ecx,word [ebp+VScroll_y] ;y-start
add ecx, edx ;add fixed height button
shl ecx, 16 ;do height next
mov cx,word [ebp+VScroll_height] ;y-start
sub cx, dx ;subtract fixed height of up button
sub cx, dx ;subtract fixed height of down button
pop edx
int 0x40 ;tell system to draw it
 
;determine height of scroll box (thumb)
 
call Vscroll_SBox_Area
add cx, [ebp+VScroll_y]
add cx, 16
shl ecx, 16
mov cx, ax
 
mov eax, 13 ;draw scroll box
mov ebx, [ebp+VScroll_width] ;x-start/width
mov edx, 0x00bbbbbb ;0x999999
int 0x40
;call Draw_Scroll_info
popa
ret
;*****************************************************************************
 
;*****************************************************************************
;* VScroll_Big_Up
;* VScroll_Small_Up
;*****************************************************************************
;need to update for signed values
VScroll_Big_Up:
push eax
push ebx
mov eax, dword [ebp+VScroll_b_change]
jmp VScroll_Up
VScroll_Small_Up:
push eax
push ebx
mov eax, dword [ebp+VScroll_s_change]
VScroll_Up:
mov ebx, dword [ebp+VScroll_min] ;get minimum value
cmp [ebp+VScroll_current], ebx ;are we at minimum already?
je VScroll_Up_exit ;if so leave
sub [ebp+VScroll_current], eax ;
jnc VScroll_Up_done
mov [ebp+VScroll_current], ebx
VScroll_Up_done:
cmp [ebp+VScroll_current], ebx ;if current is greater then max
jae VScroll_Up_done2
mov [ebp+VScroll_current], ebx
VScroll_Up_done2:
;redraw
call drawvscroll ;temp?
VScroll_Up_exit:
pop ebx
pop eax
 
ret
;*****************************************************************************
 
 
;*****************************************************************************
;* VScroll_Big_Down
;* VScroll_Small_Down
;*****************************************************************************
;need to update for signed values
VScroll_Big_Down:
push eax
push ebx
mov eax, dword [ebp+VScroll_b_change];get big change value
jmp VScroll_Down
VScroll_Small_Down:
push eax
push ebx
mov eax, dword [ebp+VScroll_s_change];get small change value
VScroll_Down:
mov ebx, dword [ebp+VScroll_max] ;get maximum scroll value
cmp [ebp+VScroll_current], ebx ;are we at max already?
je VScroll_Down_exit ;if so leave
add [ebp+VScroll_current], eax ;add change to current
jno VScroll_Down_done ;dont go beyond bounds of register
mov [ebp+VScroll_current], ebx ;if we did then we at max
VScroll_Down_done: ;
cmp [ebp+VScroll_current], ebx ;if current is greater then max
jbe VScroll_Down_done2 ;
mov [ebp+VScroll_current], ebx ;then we at max
VScroll_Down_done2: ;
;redraw
call drawvscroll ;temp?
VScroll_Down_exit:
pop ebx
pop eax
ret
;*****************************************************************************
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tinypad2/trunk/tinypad2.asm
0,0 → 1,4001
; SYSTEM HAEDER:
use32
org 0x0
db 'MENUET01' ; identifier
dd 0x01 ; version
dd START ; pointer to start
dd TINYPAD_END ; size of file
dd 0x300f00 ;0x500000; 0x3fff00;0x300000 ; size of memory
dd 0xeff0 ;0x4fffff ;0x3ff000;0xeff0 ; esp
dd I_PARAM ; parameters
dd 0 ; reserved
include 'lang.inc'
include 'ascl.inc'
include 'macros.inc' ; useful stuff
include 'dialogs1.inc'
include 'scroll.inc'
;include 'debug.inc'
purge mov ;  SPEED
;******************************************************************************
; INITIALIZING
START:
;debug_print_hex TINYPAD_END
call mask_events
 
cmp [I_PARAM],byte 0
jz noparams
 
; parameters are at I_PARAM
mov esi,I_PARAM
mov edi,filename
mov ecx,50
cld
rep movsb
 
mov edi,filename
mov ecx,50
xor eax,eax
repne scasb
sub edi,filename
dec edi
mov [filename_len],edi
jmp do_load_file
noparams:
jmp newfile
;******************************************************************************
; MAIN LOOP
still:
call writepos ; write current position & number of strings
call mouse_info
 
mov eax,10 ; wait here until event
int 0x40
 
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
cmp eax,6
je mouse
jmp still
;******************************************************************************
; *********************************
; * MOUSE *
; *********************************
mouse:
mov eax,37 ;mouse click
mov ebx,2
int 0x40
cmp eax,0
je .leave_now
;if exit window is on
cmp [exit_wnd_on],1
jne @f
mov [exit_wnd_on],0
jmp red
;else
@@:
cmp eax,1 ;mouse 1
jne .leave_now
 
mov eax,37 ;mouse position
mov ebx,1
int 0x40
 
mov word[mouse_y],ax
shr eax,16
mov word[mouse_x],ax
 
 
cmp [mouse_x],7
jb .leave_now ;.leave_now ;if <
cmp [mouse_x],485;487
ja .leave_now ;.leave_now ;if >
 
cmp [mouse_y],45
jb .leave_now ;.leave_now ;if <
cmp [mouse_y],342 ;345
ja .leave_now ;.leave_now ;if >
 
call main_cursor_move
 
.leave_now:
jmp still
 
; *********************************
; * BUTTON HANDLER *
; *********************************
 
button:
 
mov eax,17
int 0x40
;;;;;;;;;;;;;;;exit dialog box check;;;;;;;;;;;;;
cmp ah,49
je save_and_exit
cmp ah,48
je exit_now
cmp ah,47
mov [exit_wnd_on],0
je red
cmp ah,46
jne @f
 
call save_file
jmp newfile
@@:
cmp ah,45
je newfile
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;MENU CHECK;;;;;;;;;;;;;;;;;;;;;;;
cmp ah,15
jne no_d_w
call draw_window_for_dialogs
jmp still
no_d_w:
cmp ah,97
je draw_win_menu_file
cmp ah,98
je draw_win_menu_code
cmp ah,96
je draw_win_menu_text
cmp ah,95
je goto_string
cmp ah,92
je search_window
cmp ah,94
je red
cmp ah,99
je help_wnd
cmp ah,100
je new_pad_wnd
cmp ah,101
je doyouwannasave
cmp ah,102
jne nosavenow
for_key_save:
savedialog draw_window_for_dialogs,copy_fpath_s,saveerror,mypath
nosavenow:
cmp ah,103
jne noopennow
for_key_open:
opendialog draw_window_for_dialogs,copy_fpath,openerror,mypath
noopennow:
cmp ah,104
je exit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
shr eax,8
 
cmp al,50
jne no_search
 
; SEARCH {
search:
 
cmp [lines],1 ;something like bug fix
je red ;still
 
xor esi,esi
mov edi,[post]
add edi,80
imul ecx,[lines],80
sub ecx,edi ; ecx (loop counter) = lines*80-(post+80)
news:
push edi
news2:
 
; 1) LOAD BYTES
mov al,[esi+search_string]
mov bl,[edi+0x80000]
 
; 2) COMPARE BYTES
cmp al,bl
je yes_char
 
; 3) LETTER?
cmp al,'A'
jb notequal
cmp al,'z'
ja notequal
 
; 4) A->a OR a->A
cmp al,'a'
jb @f
add al,-32
jmp compare_bytes
@@:
cmp al,'Z'
ja notequal
add al,32
 
compare_bytes:
cmp al,bl
jne notequal
 
yes_char:
inc edi
inc esi
cmp esi,[search_len]
jge sfound
jmp news2
 
notequal:
pop edi
xor esi,esi
inc edi
loop news
call string_not_found
jmp still
 
sfound:
mov eax,edi
cdq ; edx = 0;
mov ebx,80
div ebx
;;;;; imul eax,80
; lea eax,[eax+eax*4] ; eax *= 5;
; shl eax,4 ; eax *= 16;
 
; mov [post],eax
mov [posy],0
;---------------
; mov ebx,80
; div ebx
call goto_pos
call draw_vertical_scroll
jmp still
; SEARCH }
 
no_search:
 
; TOOLBAR {
cmp eax,10000
jb no_toolbar
 
add eax,-10000
jne @f
lbl_compile_file:
mov [run_outfile],0
call start_fasm
jmp still
@@:
dec eax
jnz @f
lbl_run_outfile:
mov [run_outfile],1
call start_fasm
jmp still
@@:
dec eax
jnz @f
call open_debug_board
jmp still
@@:
dec eax
jnz still
call open_sysfuncs_txt
jmp still
; TOOLBAR }
 
no_toolbar:
 
cmp al,4
jne noid4
 
; LOAD_FILE {
do_load_file:
mov [modified],0
 
call empty_work_space
 
 
cmp [filename],'/'
jne @f
 
call loadhdfile
jmp .restorecursor
@@:
call loadfile1
.restorecursor:
mov edi,0x78000
mov ecx,80*80/4
mov eax,0x01010101
cld
rep stosd
xor eax,eax
mov [post],eax
mov [posx],eax
mov [posy],eax
 
; enable color syntax for ASM and INC files:
mov [asm_mode], 0
 
mov eax, [filename_len]
add eax, filename
cmp word [eax-3],'AS'
jne @f
cmp byte [eax-1],'M'
jne @f
mov [asm_mode], 1
jmp .nocol
@@:
cmp word [eax-3],'IN'
jne @f
cmp byte [eax-1],'C'
jne @f
mov [asm_mode], 1
@@:
.nocol:
 
; if the header is the same as the previous,
; just redraw the text area
; else redraw the window
 
;------pos00=filename_len
mov eax,[filename_len]
mov [pos00],eax
;-------------------------
mov ecx, [filename_len]
add ecx, 10 ; strlen(" - TINYPAD");
cmp ecx, [headlen]
jne @f
add ecx, -10
mov esi, filename ; strcmp(filename,header);
mov edi, header
rep cmpsb
jne @f
call drawfile
call draw_window_for_dialogs ;redraw, because it's needed
cmp [to_return],0
je still
ret
;jmp still
@@:
call set_title
cmp [to_return],0
je still
ret
; jmp still
; LOAD_FILE }
 
noid4:
 
cmp al, 2
jz yessave
 
dec al ; close if butid == 0
jnz nosave
; EXIT:
exit:
cmp [modified],0
je exit_now
 
mov eax,55 ; beep
mov ebx,eax
mov esi,save_beep1
int 0x40
delay 4
mov eax,55 ; beep
mov ebx,eax
mov esi,save_beep2
int 0x40
 
;---------"EXIT" dialog box
 
mov eax,13
mov ebx,150*65536+200
mov ecx,100*65536+70
mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
int 0x40
 
 
mov eax,38
mov ebx,150*65536+350
mov ecx,100*65536+100
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,150*65536+350
mov ecx,170*65536+170
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,150*65536+150
mov ecx,100*65536+170
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,350*65536+350
mov ecx,100*65536+170
mov edx,cl_White
int 0x40
 
 
 
putlabel 190,120,'‘®åà ­¨âì ¤®ªã¬¥­â?',cl_White
 
drawlbut 170,140,30,15,'„ ',49,[sc.work_button],cl_White
drawlbut 230,140,30,15,'¥â',48,[sc.work_button],cl_White
drawlbut 290,140,45,15,'Žâ¬¥­ ',47,[sc.work_button],cl_White
 
mov [exit_wnd_on],1
;----------------
 
jmp still
 
exit_now:
mov [MainWndClosed], 1
or eax, -1
int 0x40
 
save_and_exit:
call save_file
jmp exit_now
; mov [MainWndClosed], 1
; or eax, -1
; int 0x40
 
; SAVE_FILE {
yessave:
call clear_screen
call drawwindow
call save_file
; call clear_screen
; call drawwindow
mov [modified],0
 
jmp still
; SAVE_FILE }
 
nosave:
 
inc al
call read_string
 
jmp still
 
;**********************************
;* REDRAW HANDLER *
;**********************************
 
red:
; ¯¥à¥à¨á®¢ª  ®ª­ 
call clear_screen
call drawwindow
jmp still
 
 
 
;**********************************
;* KEY HANDLER *
;**********************************
 
key:
mov eax, 2 ; GET KEY
int 0x40
 
cmp [exit_wnd_on],1 ;exit window is ON?
jne no_exit_wnd ; no - goto other checks
 
; cmp eax,13 ;enter - save n exit
; je save_and_exit
 
; cmp eax,173 ;ctrl+enter - exit
; je exit_now
mov [exit_wnd_on],0 ;other keys - cancel
; call draw_window_for_dialogs
 
jmp red ;redraw and still
 
 
no_exit_wnd:
shr eax, 8
 
; HELP_TEXT {
cmp al, 210 ; Ctrl + F1
jne no_help_text
help_wnd:
call clear_screen
call drawwindow
mov eax, 51
mov ebx, 1
mov ecx, help_thread_start
mov edx, 0xfff0
int 0x40
jmp still
 
help_thread_start:
call draw_help_wnd
 
still_hw:
cmp [MainWndClosed], 1
je exit_hw
mov eax, 10
int 0x40
cmp eax, 1
je red_hw
cmp eax, 2
je key_hw
cmp eax, 3
je button_hw
jmp still_hw
 
red_hw:
call draw_help_wnd
jmp still_hw
 
key_hw:
; mov eax, 2
int 0x40
cmp ah, 27
jne still_hw
 
button_hw:
mov eax, 17
int 0x40
exit_hw:
or eax, -1
int 0x40
 
; draw help window
draw_help_wnd:
mov eax, 12
mov ebx, 1
int 0x40
 
xor eax, eax
mov ebx, 200 shl 16 + 320
mov ecx, 200 shl 16 + 260
mov edx, 0x03e0e0e0 ; work
mov esi, [sc.grab]
or esi, 0x80000000 ; grab
mov edi, [sc.frame] ; frame
int 0x40
 
mov eax, 4
mov ebx, 8 shl 16 + 8
mov ecx, 0xffffff
mov edx, help_wnd_header
mov esi, hlphead_len
int 0x40
 
mov eax, 4
mov ebx, 8 shl 16 + 34
xor ecx, ecx
mov esi, 51
mov edx, help_text
.new_help_line:
int 0x40
add ebx, 10
add edx, esi
cmp [edx], byte 'x'
jne .new_help_line
 
mov eax, 12
mov ebx, 2
int 0x40
ret
; HELP_TEXT }
 
no_help_text:
; LOAD_FILE {
cmp al, 211 ; Ctrl + F2
je for_key_open ;do_load_file
; LOAD_FILE }
 
; SEARCH {
cmp al, 212 ; Ctrl + F3
je search
; SEARCH }
 
; SAVE_FILE {
cmp al, 213 ; Ctrl + F4
je yessave
; SAVE_FILE }
 
; ENTER_FILENAME {
cmp al, 214 ; Ctrl + F5
jne @f
jmp for_key_save
@@:
; ENTER_FILENAME }
 
; ENTER_SEARCH {
cmp al, 215 ; Ctrl + F6
jne @f
; mov al, 51
; call read_string
; jmp still
jmp search_window
@@:
; ENTER_SEARCH }
 
; CHANGE_LAYOUT {
cmp al, 217 ; Ctrl + F8
jne @f
call layout
jmp still
@@:
; CHANGE_LAYOUT }
 
; COMPILE_FILE {
cmp al, 208
je lbl_compile_file
; COMPILE_FILE }
 
; RUN_OUTFILE {
cmp al, 209
je lbl_run_outfile
 
; RUN_OUTFILE }
 
;run debug board { -----
cmp al,255
jne @f
call open_debug_board
call activate_me
jmp still
;}
@@:
;open sysfuncR { -----
; cmp al,228
; jne @f
; call open_sysfuncs_txt
; jmp still
; @@:
 
;fast_save_and_open {
cmp al,216
jne @f
call make_fast_so
jmp still
;}
@@:
; 3 times english -> àãá᪨©
; 2 times àãá᪨© -> english
 
; COPY START {
cmp al, 19
jne no_copy_start
mov eax, [post]
imul ebx, [posy], 80
add eax, ebx
mov [copy_start], eax
jmp still
; COPY START }
 
no_copy_start:
; COPY END {
cmp al, 5
jne no_copy_end
cmp [copy_start], 0
je still
mov ecx, [post]
imul ebx, [posy], 80
add ecx, ebx
add ecx, 80
cmp ecx, [copy_count]
jb still
sub ecx, [copy_start]
mov [copy_count], ecx
mov esi, [copy_start]
add esi, 0x80000
mov edi, 0x2f0000
cld
rep movsb
jmp still
; COPY END }
 
no_copy_end:
 
; PASTE {
cmp al, 16
jne no_copy_paste
cmp [copy_count], 0
je still
mov eax,[copy_count]
cdq
mov ebx, 80
div ebx
add [lines], eax
mov ecx, 0x2e0000
mov eax, [post]
imul ebx, [posy], 80
add eax, ebx
add eax, 0x80000
sub ecx, eax
mov esi, 0x2e0000
sub esi, [copy_count]
mov edi, 0x2e0000
std
rep movsb
mov esi, 0x2f0000
mov edi, [post]
imul eax, [posy], 80
add edi, eax
add edi, 0x80000
mov ecx, [copy_count]
cld
rep movsb
 
call clear_screen
call drawfile
call draw_vertical_scroll
mov [modified],1
 
jmp still
; PASTE }
 
 
no_copy_paste:
 
 
; INSERT_SEPARATOR {
cmp al,0xc ; Ctrl+L
jne no_insert_separator
 
imul eax,[posy],80
add eax,[post]
add eax,0x80000
mov ebx,eax
 
imul eax,[lines],80
add eax,0x80000 ; ⥯¥àì 㪠§ë¢ ¥â ­  ª®­¥æ ä ©« 
 
mov ecx,eax ; size
sub ecx,ebx
inc ecx
 
mov esi,eax ; from
mov edi,eax
add edi,80 ; to
 
std
rep movsb
 
mov ecx,80/4
mov esi,comment_string
mov edi,ebx
cld
rep movsd
 
inc [lines]
 
call clear_screen
call drawfile
;call calc_scroll_size_and_pos
call draw_vertical_scroll
mov [modified],1
 
jmp still
; INSERT_SEPARATOR }
 
 
no_insert_separator:
 
 
; DEL_LINE {
cmp al,4
jne no_delete_line
mov eax,[post]
cdq
mov ebx,80
div ebx
add eax,[posy]
inc eax
cmp eax,[lines]
jge still
dec dword [lines]
imul edi,[posy],80
add edi,[post]
add edi,0x80000
mov esi,edi
add esi,80
mov ecx,0x2e0000
sub ecx,esi
shr ecx,4
cld
rep movsd
call clear_screen
call drawfile
;call calc_scroll_size_and_pos
call draw_vertical_scroll
mov [modified],1
 
jmp still
; DEL_LINE }
 
no_delete_line:
 
; ENTER {
cmp al,13
jnz noenter
 
; lines down
mov eax,[posy]
inc eax
; imul eax,80
lea eax,[eax+eax*4] ; eax *= 5
shl eax,4 ; eax *= 16
add eax,0x80000
add eax,[post]
mov ebx,eax
 
; ebx = ([posy]+1)*80 + 0x80000 + [post]
; ebx -> first byte of next string
 
imul eax,[lines],80
add eax,0x80000
mov ecx,eax
 
; ecx = [lines]*80 + 0x80000
; ecx -> end of the document
 
cmp ebx,ecx
jz .bug_fixed
 
@@:
dec ecx
mov dl,[ecx]
mov [ecx+80],dl
 
cmp ecx,ebx
jnz @b
 
.bug_fixed:
 
; save for later
imul eax,[posy],80
add eax,0x80000
add eax,[post]
mov ebx,eax
add eax,[posx]
; eax = 0x80000 + [post] + [posy]*80 + [posx]
 
push eax
 
dec ebx
xor ecx,ecx
@@:
cmp ecx,80
je @f
inc ecx
inc ebx
cmp byte [ebx],' '
je @b
@@:
dec ecx
 
cmp ecx,80-1
jne @f
; mov [posx],0
jmp .lbl
@@:
 
cmp [posx],ecx
jbe @f
mov [posx],ecx
jmp .lbl
@@:
mov [posx],0
 
.lbl:
inc [posy]
 
;clear line
imul eax,[posy],80
add eax,0x80000
add eax,[post]
 
mov edi,eax
mov eax,' '
mov ecx,80/4
cld
rep stosd
 
 
; end of line to next line beginning
imul eax,[posy],80
add eax,0x80000
add eax,[post]
; add eax,[posx]
mov ebx,eax
; ebx -> beginning of this line
 
pop esi
mov edi,eax
 
@@:
mov al,[esi]
mov [ebx],al
mov [esi],byte ' '
 
inc esi
inc ebx
 
cmp esi,edi
jb @b
 
inc [lines]
 
mov ecx,[posy]
cmp ecx,[slines]
jne @f
 
dec [posy]
add [post],80
 
@@:
call clear_screen
call drawfile
;call calc_scroll_size_and_pos
 
call draw_vertical_scroll
mov [modified],1
 
jmp still
; ENTER }
 
 
noenter:
 
 
; UP {
cmp al,130+48
jnz noup
mov ecx,[posy]
test ecx,ecx
jnz .up1
mov ecx,[post]
test ecx,ecx
jz still
add ecx,-80
mov [post],ecx
call clear_screen
jmp .finish
.up1:
dec ecx
mov [posy],ecx
.finish:
call drawfile
call draw_vertical_scroll
;call calc_scroll_size_and_pos
 
jmp still
; UP }
 
noup:
 
; DOWN {
cmp al,129+48
jnz nodown
 
mov ecx,[posy]
mov eax,[slines]
dec eax
cmp ecx,eax
jb .do1 ; goto do1 if [posy] < [slines]-1
 
mov eax,[lines]
sub eax,[slines]
dec eax
jb still ; goto still if [lines] < [slines]-1
; imul eax,80
lea eax,[eax+eax*4]
shl eax,4
cmp [post],eax
jg still ; goto still if [post] > ([lines]-[slines]-1)*80
 
add [post],80
call clear_screen
call drawfile
call draw_vertical_scroll
;call calc_scroll_size_and_pos
 
jmp still
 
.do1:
pusha
mov eax,[post]
cdq
mov ebx,80
div ebx
add eax,[posy]
inc eax
cmp eax,[lines]
jb .do10
popa
jmp still
 
.do10:
popa
inc ecx
mov [posy],ecx
call drawfile
call draw_vertical_scroll
;call calc_scroll_size_and_pos
 
jmp still
; DOWN }
 
 
nodown:
 
 
; LEFT {
cmp al,128+48
jnz noleft
cmp [posx],0
je still
dec [posx]
call drawfile
jmp still
; LEFT }
 
 
noleft:
 
 
; RIGHT {
cmp al,131+48
jnz noright
cmp [posx],79
je still
inc [posx]
call drawfile
jmp still
; RIGHT }
 
 
noright:
 
 
; PAGE_UP {
page_up:
cmp al,136+48
jnz nopu
scrl_up:
mov eax,[slines]
dec eax
; imul eax,80
lea eax,[eax+eax*4]
shl eax,4
mov ecx,[post]
cmp eax,ecx
jbe pu1
mov ecx,eax
pu1:
sub ecx,eax
mov [post],ecx
 
call clear_screen
call drawfile
call draw_vertical_scroll
;call calc_scroll_size_and_pos
jmp still
; PAGE_UP }
 
 
nopu:
 
 
; PAGE_DOWN {
page_down:
cmp al,135+48
jnz nopd
scrl_down:
mov eax,[lines]
cmp eax,[slines]
jb still
 
mov eax,[post] ; eax = offset
cdq
mov ebx,80
div ebx ; eax /= 80
mov ecx,[lines] ; ecx = lines in the file
cmp eax,ecx ; if eax < ecx goto pfok
jnb still
mov eax,[slines] ; eax = lines on the screen
dec eax ; eax--
; imul eax,80 ; eax *= 80
lea eax,[eax+eax*4]
shl eax,4
add [post],eax ; offset += eax
 
mov eax,[lines] ; eax = lines in the file
sub eax,[slines] ; eax -= lines on the screen
; imul eax,80 ; eax *= 80
lea eax,[eax+eax*4]
shl eax,4
cmp [post],eax
jb @f
mov [post],eax
@@:
 
call clear_screen
call drawfile
call draw_vertical_scroll
;call calc_scroll_size_and_pos
 
jmp still
; PAGE_DOWN }
 
nopd:
 
; HOME {
cmp al,132+48
jnz nohome
 
push 0
pop [posx]
 
call drawfile
jmp still
; HOME }
 
 
nohome:
 
 
; END {
end_key:
cmp al,133+48
jnz noend
 
imul eax,[posy],80
add eax,0x80000
add eax,[post]
 
mov esi,eax
add eax,80+1
 
@@: dec eax
cmp eax,esi
je @f
cmp byte [eax-1],' '
jbe @b
@@:
sub eax,esi
cmp eax,80-1
jbe @f
dec eax
@@:
mov [posx],eax
 
call drawfile
jmp still
; END }
 
 
noend:
 
 
; GO_START {
cmp al,251 ; Ctrl + [
jnz no_go_to_start
 
push 0
pop [post] ; offset = 0
 
call clear_screen
call drawfile ; draw file
call draw_vertical_scroll
;call calc_scroll_size_and_pos
jmp still ; go to still
; GO_START }
 
 
no_go_to_start:
 
 
; GO_END {
cmp al,253 ; Ctrl + ]
jnz no_go_to_end
cmp [lines],30 ;to fix ctrl+] bug
jb @f
mov eax,[lines] ; eax = lines in the file
sub eax,[slines] ; eax -= lines on the screen
; imul eax,80 ; eax *= 80 (length of line)
lea eax,[eax+eax*4]
shl eax,4
mov [post],eax ; offset in the file
 
call clear_screen
call drawfile ; draw file
call draw_vertical_scroll
@@:
jmp still ; go to still
; GO_END }
 
 
no_go_to_end:
 
 
; DELETE {
cmp al,134+48
jne nodel
 
imul eax,[posy],80
add eax,0x80000
add eax,[post]
add eax,[posx]
mov ecx,eax
 
imul eax,[posy],80
add eax,0x80000+79
add eax,[post]
mov ebx,eax
 
push ebx
 
dec ecx
dec ebx
 
 
push ecx ebx
 
push ebx
 
imul eax,[posy],80
add eax,0x80000
add eax,[post]
mov ecx,eax
 
xor eax,eax
cdq
 
pop ebx
 
dec ecx
@@:
inc ecx
mov dh,[ecx]
cmp dh,33
jb .nok
xor eax,eax
inc eax
.nok:
cmp ecx,ebx
jb @b
 
pop ebx ecx
 
@@:
inc ecx
mov dl,[ecx+1]
mov [ecx],dl
cmp ecx,ebx
jb @b
 
 
pop ebx
mov [ebx],byte 32
 
test eax,eax
jz dellinesup
 
call clear_screen
call drawfile
mov [modified],1
 
jmp still
 
dellinesup:
 
; lines -1
 
pusha
 
mov eax,[post]
cdq
mov ebx,80
div ebx
add eax,[posy]
inc eax
 
cmp eax,[lines]
jb @f
 
popa
mov [modified],1
 
jmp still
 
@@:
 
popa
 
dec [lines]
 
; lines up
 
mov [posx],dword 0
 
imul eax,[posy],80
add eax,0x80000-1
add eax,[post]
mov ebx,eax
 
push ebx
 
imul eax,[lines],80
add eax,0x80000-1
add eax,[post]
mov ecx,eax
 
pop ebx
 
@@:
mov dl,[ebx+80]
mov [ebx],dl
inc ebx
 
cmp ecx,ebx
jnz @b
 
call clear_screen
call drawfile
mov [modified],1
 
jmp still
; DELETE }
 
 
nodel:
 
 
; INSERT {
cmp al,137+48
jnz noins
 
imul eax,[posy],80
add eax,0x80000
add eax,[post]
add eax,[posx]
mov ecx,eax
; ecx = [posy]*80+0x80000+[post]+[posx]
 
imul eax,[posy],80
add eax,0x80000+79
add eax,[post]
mov ebx,eax
; ebx = [posy]*80+0x80000+79+[post]
 
.movstr:
dec ebx
mov dl,[ebx]
mov [ebx+1],dl
cmp ecx,ebx
jb .movstr
 
mov [ecx],byte ' '
 
call invalidate_string
call drawfile
mov [modified],1
 
jmp still
; INSERT }
 
 
noins:
 
 
; BACKSPACE {
cmp al,8
jnz nobs
mov ecx,[posx]
test ecx,ecx
jz still
dec ecx
mov [posx],ecx
 
imul eax,[posy],80
add eax,0x80000
add eax,[post]
add eax,[posx]
mov ebx,eax
 
push ebx
 
imul eax,[posy],80
add eax,0x80000+79
add eax,[post]
mov ebx,eax
 
pop ecx
 
push ebx
 
dec ecx
.movleft:
inc ecx
mov dl,[ecx+1]
mov [ecx],dl
cmp ecx,ebx
jb .movleft
 
pop ebx
mov [ebx],byte ' '
 
call invalidate_string
call drawfile
mov [modified],1
 
jmp still
; BACKSPACE }
 
 
nobs:
 
 
; TAB {
cmp eax,9 ; Tab
jne notab
 
mov eax,[posx]
cmp eax,80-1
jae still
add eax,5 ; 9 5 3
and eax,11111100b ; ...1000b, ...100b, ...10b
dec eax
mov [posx], eax
 
call drawfile
mov [modified],1
 
jmp still
; TAB }
 
 
notab:
 
 
; ADD_KEY {
push eax ; add key
 
imul eax,[posy],80
add eax,0x80000
add eax,[post]
add eax,[posx]
mov ecx,eax
 
push ecx
 
imul eax,[posy],80
add eax,0x80000+79
add eax,[post]
mov ebx,eax
 
.movright:
dec ebx
mov al,[ebx]
mov [ebx+1],al
cmp ecx,ebx
jbe .movright
 
pop ebx
 
pop eax
 
mov [ebx],al
mov edx,78
mov ecx,[posx]
cmp edx,ecx
jb noxp
inc ecx
mov [posx],ecx
noxp:
 
call invalidate_string
call drawfile
mov [modified],1
; call draw_vertical_scroll
jmp still
; ADD_KEY }
 
 
;******************************************************************************
 
start_fasm:
cmp [asm_mode],1
je @f
ret
@@:
mov esi,filename
mov edi,fasm_parameters
 
cmp byte [esi],'/'
je .yes_systree
 
mov ecx,[filename_len]
rep movsb
 
mov al,','
stosb
 
mov ecx,[filename_len]
add ecx,-4
mov esi,filename
rep movsb
 
mov al,','
stosb
 
mov [edi],dword '/RD/'
add edi,4
mov [edi],word '1/'
inc edi
inc edi
 
mov al,0
stosb
 
jmp .run
 
.yes_systree:
add esi,[filename_len]
dec esi
 
xor ecx,ecx
mov al,'/'
@@:
cmp [esi],al
je @f
dec esi
inc ecx
jmp @b
@@:
inc esi
 
push esi
push esi
push ecx
 
rep movsb
 
mov al,','
stosb
 
pop ecx
pop esi
 
add ecx,-4
rep movsb
 
mov al,','
stosb
 
pop ecx
sub ecx,filename
mov esi,filename
 
rep movsb
 
mov al,0
stosb
 
.run:
cmp [run_outfile],1
jne @f
dec edi
mov eax,',run'
stosd
mov al,0
stosb
@@:
 
mov eax,19
mov ebx,fasm_filename
mov ecx,fasm_parameters
int 0x40
ret
 
open_debug_board:
mov eax,19
mov ebx,debug_filename
xor ecx,ecx
int 0x40
ret
 
open_sysfuncs_txt:
mov eax,19
mov ebx,tinypad_filename
mov ecx,sysfuncs_filename
int 0x40
ret
 
 
empty_work_space:
; ®ç¨áâ¨âì ¢á¥
mov eax,' '
mov edi,0x80000
mov ecx,(0x300000-0x90000)/4
cld
rep stosd
mov edi,0x10000
mov ecx,0x60000/4
rep stosd
ret
 
 
clear_screen:
; ®ç¨áâ¨âì íªà ­
mov ecx,80*40
mov edi,0x78000
xor eax,eax
@@:
mov [edi],eax
add edi,4
dec ecx
jnz @b
ret
 
invalidate_string:
imul eax,[posy],80
add eax,0x78000
mov edi,eax
mov al,1
mov ecx,80/4
rep stosd
ret
 
layout:
; ᬥ­¨âì à áª« ¤ªã ª« ¢¨ âãàë
mov eax,19
mov ebx,setup
mov ecx,param_setup
int 0x40
mov eax,5
mov ebx,eax
int 0x40
call activate_me
ret
 
 
activate_me:
; 1) get info about me
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
; eax = number of processes
 
; save process counter
inc eax
inc eax
mov [proccount],eax
 
mov eax,[procinfo.PID]
mov [PID],eax
 
; 2) get my process number
mov eax,9
mov ebx,procinfo
mov ecx,[proccount]
@@:
dec ecx
jz @f ; counter=0 => not found? => return
mov eax,9
int 0x40
mov edx,[procinfo.PID]
cmp edx,[PID]
jne @b
 
;found: ecx = process_number
mov eax,18
mov ebx,3
int 0x40
 
mov eax,5
mov ebx,eax
int 0x40
 
@@:
ret
 
 
 
 
; *******************************************************************
; ************************** DRAW WINDOW **************************
; *******************************************************************
 
align 4
drawwindow:
 
mov eax,12 ; WINDOW DRAW START
mov ebx,1
int 0x40
mov [menu_is_on],0
mov eax,48 ; get system colors
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
 
mov [sc.work],0xe0e0e0
 
xor eax,eax ; DEFINE WINDOW
mov ebx,100*65536+506 ; 496
mov ecx,75*65536+400 ;385;400 ; sum < 480 for 640x480
mov edx,[sc.work]
add edx,0x03000000
mov esi,[sc.grab]
or esi,0x80000000
mov edi,[sc.frame]
int 0x40
 
; header string
mov eax,4
mov ebx,10*65536+8
mov ecx,[sc.grab_text]
mov edx,header
mov esi,[headlen]
int 0x40
 
mov eax,9 ; get info about me
mov ebx,procinfo
or ecx,-1
int 0x40
 
mov eax,[procinfo.y_size]
 
mov [do_not_draw],1 ; do_not_draw = true
cmp eax,100
jb .no_draw ; do not draw text & buttons if height < 100
mov [do_not_draw],0 ; do_not_draw = false
add eax,-(46+47) ; 46 = y offs
cdq
mov ebx,10
div ebx
mov [slines],eax
 
cmp eax,[posy]
jnb @f
dec eax
mov [posy],eax
@@:
 
mov eax,[procinfo.y_size] ; calculate buttons position
add eax,-47
mov [dstart],eax
 
; mov eax,8 ; STRING BUTTON
; mov ebx,5*65536+57
; mov ecx,[dstart]
; add ecx,29
; shl ecx,16
; add ecx,13
; mov edx,51 ;;;;;-----string button ID=51
; mov esi,[sc.work_button]
; int 0x40
; SEARCH BUTTON
; mov ebx,(505-129)*65536+125
; mov edx,50
; mov esi,[sc.work_button]
; int 0x40
 
; mov eax,4 ; SEARCH TEXT
; mov ebx,[dstart]
; add ebx,7*65536+32
; mov ecx,[sc.work_button_text]
; mov edx,searcht
; mov esi,searchtl-searcht
; int 0x40
 
 
mov eax,13 ; BAR STRIPE
mov ebx,5*65536+497
mov ecx,[dstart]
shl ecx,16
add ecx,30 ;15
 
mov edx,0x00aaaaaa
int 0x40
 
; mov eax,4 ; FIRST TEXT LINE (POSITION...)
; mov ebx,12*65536
; add ebx,[dstart]
; add ebx,38 ;18
; mov ecx,[sc.work_button_text]
; mov edx,htext2
; mov esi,htextlen2-htext2
; int 0x40
 
 
call drawfile
 
; mov eax,[dstart]
 
; add eax,31
; mov [ya],eax
; mov [addr],search_string
; call print_text
 
.no_draw:
call draw_win_menu
 
call draw_vertical_scroll
 
mov eax,12 ; WINDOW DRAW END
mov ebx,2
int 0x40
 
ret
 
 
 
 
; **********************************
; *********** DRAWFILE ***********
; **********************************
 
drawfile:
;---------------
cmp [menu_is_on],1
jne .ff
call drawwindow
.ff:
;---------------
mov [next_not_quote],1
mov [next_not_quote2],1
 
mov eax,[post] ; print from position
 
pusha
 
mov edi,[post]
mov [posl],edi
 
mov ebx,8*65536+46 ; letters (46 = y offs)
xor ecx,ecx
 
mov edx,0x80000
add edx,eax
mov edi,edx
 
imul esi,[slines],80
add edi,esi
 
 
nd:
 
pusha
 
mov edx,ebx
mov edi,ebx
add edi,(6*65536)*80
 
wi1:
 
 
; draw ?
 
 
pusha
 
push ecx
 
imul eax,[posx],6
add eax,8
shl eax,16
mov ecx,eax
 
;  ecx = ([posx]*6+8)<<16
 
imul eax,[posy],10
add eax,46 ; y offs
add eax,ecx
 
;  eax = [posy]*10+46+ecx
 
pop ecx
 
cmp edx,eax
jnz drwa
 
mov eax,0x7ffff
call check_pos
jmp drlet
 
drwa:
 
popa
 
 
pusha
 
imul eax,[posxm],6
add eax,8
shl eax,16
mov ecx,eax
 
imul eax,[posym],10
add eax,46 ; y offs
add eax,ecx
 
cmp edx,eax
jnz drwa2
 
mov eax,0x7ffff
call check_pos
jmp drlet
 
drwa2:
 
popa
 
pusha
 
mov eax,0x78000 ; screen
add eax,[posl] ; screen+abs
sub eax,[post] ; eax = screen+abs-base = y*80+x + screen
 
mov edx,0x80000 ; file
add edx,[posl] ; edx = absolute
mov bl,[edx] ; in the file
 
call check_pos
 
mov cl,[eax] ; on the screen
cmp bl,cl
jnz drlet
 
popa
 
jmp nodraw
 
 
; draw letter
 
 
drlet:
 
mov [eax],bl ; mov byte to the screen
mov [tmpabc],bl
popa ; restore regs
 
;!!!!!!!!!!!!
 
cmp [tmpabc],' '
je @f
call draw_letter
jmp nodraw
@@:
call clear_char
 
nodraw:
 
inc [posl]
 
add edx,6*65536
cmp edx,edi
jz wi3
jmp wi1
 
wi3:
 
popa
 
add ebx,10
add edx,80
cmp edi,edx
jbe nde
jmp nd
 
nde:
 
mov eax,[posx]
mov ebx,[posy]
 
mov [posxm],eax
mov [posym],ebx
 
popa
 
ret
 
stText = 0
stInstr = 1
stReg = 2
stNum = 3
stQuote = 4
stComment = 5
stSymbol = 6
 
align 4
 
clear_char:
 
pusha
mov ebx,[sc.work]
 
push ecx
 
imul eax,[posx],6
add eax,8
shl eax,16
mov ecx,eax
 
imul eax,[posy],10
add eax,46 ; 26
add eax,ecx
 
pop ecx
cmp edx,eax
jnz @f
mov ebx,0xffffff ; light blue 0x00ffff
@@:
 
; draw bar
push ebx
mov eax,13
mov ebx,edx
mov bx,6
mov ecx,edx
shl ecx,16
add ecx,10
pop edx
int 0x40
popa
ret
 
align 4
 
; CHECK_POSITION {
check_pos:
cmp [asm_mode],1
je @f
 
mov [d_status],stText
ret
 
@@:
pushad
 
; COMMENT TERMINATOR
cmp [d_status],stComment
jnz @f
mov eax,[posl]
sub eax,[post]
cdq
mov ebx,80
div ebx
test edx,edx
jnz end_check_pos
mov [d_status],stText
@@:
 
; QUOTE TERMINATOR B
cmp [next_not_quote],1
jne @f
mov [d_status],stText
@@:
 
mov eax,[posl]
add eax,0x80000
mov edx,eax
mov al,[eax]
 
; QUOTE TERMINATOR A
cmp [d_status],stQuote
jnz @f
cmp al,[quote]
jne end_check_pos
mov [next_not_quote],1
jmp end_check_pos
@@:
mov [next_not_quote],0
 
; START QUOTE 1
cmp al,"'"
jne @f
mov [d_status],stQuote
mov [quote],al
jmp end_check_pos
@@:
 
; START QUOTE 2
cmp al,'"'
jne @f
mov [d_status],stQuote
mov [quote],al
jmp end_check_pos
@@:
 
; START COMMENT
cmp al,';'
jne @f
mov [d_status],stComment
jmp end_check_pos
@@:
 
; NUMBER TERMINATOR
cmp [d_status],stNum
jne nonumt
mov ecx,23
@@:
dec ecx
jz nonumt
cmp al,[symbols+ecx]
jne @b
 
nonumt1:
mov [d_status],stText
nonumt:
 
; START NUMBER
cmp [d_status],stNum
je end_check_pos
cmp al,'0'
jb nonum
cmp al,'9'
ja nonum
mov bl,[edx-1]
mov ecx,23
@@:
dec ecx
jz nonum
cmp bl,[symbols+ecx]
jne @b
@@:
mov [d_status],stNum
jmp end_check_pos
nonum:
 
; SYMBOL
mov esi,symbols
mov ecx,21
@@:
cmp byte [esi],al
je @f
dec ecx
jz nosymbol
inc esi
jmp @b
@@:
mov [d_status],stSymbol
jmp end_check_pos
 
nosymbol:
mov [d_status],stText
 
end_check_pos:
popad
ret
; CHECK_POSITION }
 
 
;;;;;;;;;;;;;;;;;
;; DRAW LETTER ;;
;;;;;;;;;;;;;;;;;
draw_letter:
 
call clear_char
 
pusha
 
mov ebx,edx ; x & y
 
mov eax,[d_status]
mov ecx,[eax*4+color_tbl]
mov eax,4
 
xor esi,esi
inc esi
mov edx,0x80000
mov edi,[posl]
add edx,edi
int 0x40
 
popa
 
ret
 
 
; ********************************************
; **************** SAVEFILE ****************
; ********************************************
save_file:
mov esi,0x80000
mov edi,0x10000
or ecx,-1
.new_string:
inc ecx
call save_string
cmp ecx,[lines]
jb .new_string
 
sub edi,0x10004 ; why???
mov [filelen],edi
 
cmp byte [filename],'/'
je .systree_save
 
mov eax,33
mov ebx,filename
mov ecx,0x10000
mov edx,[filelen]
xor esi,esi
int 0x40
 
test eax,eax
je .finish
; call file_not_found
call disk_is_full
;==============================
jmp .finish
 
.systree_save:
mov eax,[filelen]
mov [fileinfo_write+8],eax
 
mov esi,filename
mov edi,pathfile_write
mov ecx,50
cld
rep movsb
 
mov eax,58
mov ebx,fileinfo_write
int 0x40
cmp eax,0
je .finish
call disk_is_full
.finish:
call draw_window_for_dialogs
mov [modified],0
ret
 
save_string:
push ecx
push esi
mov eax,esi
mov ebx,eax
add ebx,79
.countlen:
cmp ebx,eax
jb .endcount
cmp byte [ebx],' '
jne .endcount
dec ebx
jmp .countlen
.endcount:
inc ebx
sub ebx,eax
 
mov ecx,ebx
jecxz .endcopy
.copystr:
mov al,[esi]
mov [edi],al
inc esi
inc edi
dec ecx
jnz .copystr
.endcopy:
 
mov eax,0x0a0d
stosw
 
pop esi
add esi,80
pop ecx
ret
 
 
 
; ********************************************
; **************** LOADFILE ****************
; ********************************************
 
loadhdfile:
 
mov esi,filename
mov edi,pathfile_read
mov ecx,250 ;50
cld
rep movsb
 
mov eax,58
mov ebx,fileinfo_read
int 0x40
 
xchg eax,ebx
inc eax
test ebx,ebx ;errorcode=0 - ok
je file_found
cmp ebx,6 ;errorcode=5 - ok
je file_found
call file_not_found
ret
 
 
loadfile1:
 
mov eax,6 ; 6 = open file
mov ebx,filename
xor ecx,ecx
mov edx,16800
mov esi,0x10000
int 0x40
 
inc eax ; eax = -1 -> file not found
jnz file_found ;strannaya proverka (Ed)
 
call file_not_found
ret
 
 
file_found:
dec eax
; eax = file size
jz .finish
mov [filesize],eax
 
mov edi,0x80000 ; clear all
@@:
mov [edi],byte ' '
inc edi
cmp edi,0x2effff
jnz @b
 
mov [lines],0
mov edi,0x10000
mov ebx,0x80000
 
; edi = from
; ebx = to
; eax = filesize
 
.new_char:
mov cl,[edi] ; get_char();
cmp cl,13 ; if (char==13)
je .new_str1 ; goto .new_str1;
cmp cl,10 ; if (char==10)
je .new_str2 ; goto .new_str2;
mov [ebx],cl ; store_char();
inc ebx ; dest++;
.back:
inc edi ; src++;
dec eax ; counter--;
jnz .new_char ; if (counter!=0) goto .new_char;
 
.finish:
inc [lines] ; [lines]++;
ret
 
.new_str1:
pusha
mov eax,ebx ; eax = destination
add eax,-0x80000 ; eax = offset
cdq
mov ecx,80
div ecx ; offset /= 80;
test edx,edx ; if not the first char in the string
jne @f ; go forward
test eax,eax ; if first line
je @f ; go forward
cmp [edi-1],byte 10; if previous char != 10 continue without line feed
jne .contin
@@:
inc eax ; offset++;
imul eax,80 ; offset *= 80;
add eax,0x80000
mov [esp+4*4],eax ; to ebx
.contin:
popa
inc edi ; do not look on the next char (10)
dec eax ; counter--;
inc [lines] ; [lines]++;
jmp .back
 
 
.new_str2:
pusha
mov eax,ebx
add eax,-0x80000
cdq
mov ecx,80
div ecx
inc eax
imul eax,80
add eax,0x80000
mov [esp+4*4],eax ; to ebx
popa
inc [lines]
jmp .back
 
 
file_not_found:
mov eax,55 ; beep
mov ebx,eax
mov esi,error_beep
int 0x40
mov [lines],1 ; open empty document
 
mov [to_return2],1
call openerror
 
ret
 
disk_is_full:
mov eax,55 ; beep
mov ebx,eax
mov esi,error_beep
int 0x40
mov [to_return2],1
call saveerror
mov [error2_found],1
ret
 
 
; *****************************
; ****** WRITE POSITION ******
; *****************************
 
writepos:
 
cmp [do_not_draw],1 ; return if drawing is not permitted
jne @f
ret
@@:
 
pusha
 
mov eax,[posx]
inc eax
cdq
mov ebx,10
div ebx
add al,'0'
add dl,'0'
mov [htext2+ 9],al
mov [htext2+10],dl
 
mov eax,[post]
cdq
mov ebx,80
div ebx
mov [real_posy],eax ;=====!!!!!!!!!
 
add eax,[posy]
inc eax
mov ebx,10
cdq
div ebx
add dl,'0'
mov [htext2+16],dl ; 00001
cdq
div ebx
add dl,'0'
mov [htext2+15],dl ; 00010
cdq
div ebx
add dl,'0'
mov [htext2+14],dl ; 00100
cdq
div ebx
add dl,'0'
add al,'0'
mov [htext2+13],dl ; 01000
mov [htext2+12],al ; 10000
 
 
mov eax,[lines] ; number of lines
cdq
mov ebx,10
div ebx
add dl,'0'
mov [htext2+31],dl ; 0001
cdq
div ebx
add dl,'0'
mov [htext2+30],dl ; 0010
cdq
div ebx
add dl,'0'
mov [htext2+29],dl ; 0100
cdq
div ebx
add dl,'0'
add al,'0'
mov [htext2+28],dl
mov [htext2+27],al ; 10000
 
; €„Ž › Ž’Ž€†€’œ €‘Š‹€„Š“ Š‹€‚ˆ€’“›!
; mov [htext2+42], word 'RU'
 
; mov eax,13 ; draw bar
; mov ebx,5*65536+38*6
; mov ecx,[dstart]
; shl ecx,16
; add ecx,15
; mov edx,[sc.work_graph]
; int 0x40
 
mov eax,13 ; BAR STRIPE
mov ebx,5*65536+497
mov ecx,[dstart]
add ecx,29;30 ;15
shl ecx,16
add ecx,14
mov edx,[sc.work_graph]
int 0x40
 
mov eax,4 ; write position
mov ebx,12*65536
mov bx,word [dstart]
add ebx,33 ;18
mov ecx,[sc.work_button_text]
mov edx,htext2
mov esi,38
int 0x40
 
cmp [modified],1
jne no_mod
putlabel 270,386,'ˆ‡Œ……',[sc.work_button_text]
no_mod:
popa
 
ret
 
;-----------------------------
; search window
;-----------------------------
search_window:
 
mov eax,13
mov ebx,55*65536+380
mov ecx,100*65536+60
mov edx,[sc.work_graph]
int 0x40
 
mov eax,38
mov ebx,55*65536+435
mov ecx,100*65536+100
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,55*65536+55
mov ecx,100*65536+160
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,435*65536+435
mov ecx,100*65536+160
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,55*65536+435
mov ecx,160*65536+160
mov edx,cl_White
int 0x40
 
 
drawlbut 375,110,50,15,'®¨áª',50,[sc.work_button],[sc.work_button_text]
drawlbut 375,130,50,15,'Žâ¬¥­ ',94,[sc.work_button],[sc.work_button_text]
 
call read_string
 
; add eax,31
; mov [ya],eax
; mov [addr],search_string
; call print_text
 
 
 
jmp search
 
string_not_found:
mov eax,13
mov ebx,150*65536+200
mov ecx,100*65536+70
mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
int 0x40
 
mov eax,38
mov ebx,150*65536+350
mov ecx,100*65536+100
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,150*65536+350
mov ecx,170*65536+170
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,150*65536+150
mov ecx,100*65536+170
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,350*65536+350
mov ecx,100*65536+170
mov edx,cl_White
int 0x40
 
 
putlabel 195,120,'‘âப  ­¥ ­ ©¤¥­­ !',cl_White
 
drawlbut 235,140,30,15,'Žª',94,[sc.work_button],cl_White
 
ret
 
read_string:
 
push eax
;----------------
mov eax,40
mov ebx,00000000000000000000000000000111b
int 0x40
;----------------
pop eax
 
; cmp al,51
; jz .f2
; ret
 
.f2:
mov [addr],dword search_string
mov eax,[dstart]
add eax,17+14
mov [ya],eax
mov [case_sens],1
 
.rk:
 
mov edi,[addr]
 
mov eax,[addr]
mov eax,[eax-4]
mov [temp],eax
 
add edi,eax
 
call print_text
 
.waitev:
mov eax, 10
int 0x40
cmp eax, 2
jne .read_done
int 0x40
shr eax, 8
 
cmp al, 13 ; enter
je .read_done
 
cmp al,27
jne ._f
jmp red
._f:
cmp al, 192 ; Ctrl + space
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_text
jmp .waitev
 
.noclear:
 
cmp al, 8 ; backspace
jnz .nobsl
cmp [temp], 0
jz .waitev
dec [temp]
mov edi, [addr]
add edi, [temp]
mov [edi], byte 0
 
mov eax,[addr]
dec dword [eax-4]
 
call print_text
jmp .waitev
 
.nobsl:
cmp [temp],50
jae .read_done
 
; CONVERT CHAR TO UPPER CASE:
cmp al, ' ' ; below "space" - ignore
jb .waitev
cmp [case_sens], 1 ; case sensitive?
je .keyok
cmp al, 'a'
jb .keyok
cmp al, 'z'
ja .keyok
sub al, 32
.keyok:
 
mov edi,[addr]
add edi,[temp]
mov [edi],al
 
inc [temp]
 
mov eax,[addr]
inc dword [eax-4]
call print_text
 
cmp [temp],50
jbe .waitev
 
.read_done:
mov ecx,50
sub ecx,[temp]
mov edi,[addr]
add edi,[temp]
xor eax,eax
cld
rep stosb
 
mov [temp],987
 
call print_text
call mask_events
ret
 
 
print_text:
 
pusha
 
mov eax,13
mov ebx,64*65536+50*6+2
; mov ecx,[ya]
; shl ecx,16
; add ecx,12
mov ecx,110*65536+12
mov edx,[sc.work]
int 0x40
 
mov edx,[addr]
mov esi,[edx-4]
mov eax,4
mov ebx,65*65536+112 ;2
; add ebx,[ya]
mov ecx,[color_tbl+0]
int 0x40
 
cmp [temp],50
ja @f
 
; draw cursor
; {
; mov eax,[ya]
mov eax,18*65536+102 ;65
mov ebx,eax
shl eax,16
add eax,ebx
add eax,10
mov ecx,eax
 
mov eax,[temp]
; imul eax,6
lea eax,[eax+eax*2]
shl eax,1
add eax,65
mov ebx,eax
shl eax,16
add ebx,eax
 
mov eax,38
mov edx,[color_tbl+0]
int 0x40
; }
 
@@:
popa
 
ret
 
 
 
; mov eax,8 ; STRING BUTTON
; mov ebx,5*65536+57
; mov ecx,[dstart]
; add ecx,29
; shl ecx,16
; add ecx,13
; mov edx,51 ;;;;;-----string button ID=51
; mov esi,[sc.work_button]
; int 0x40
; SEARCH BUTTON
; mov ebx,(505-129)*65536+125
; mov edx,50
; mov esi,[sc.work_button]
; int 0x40
 
; mov eax,4 ; SEARCH TEXT
; mov ebx,[dstart]
; add ebx,7*65536+32
; mov ecx,[sc.work_button_text]
; mov edx,searcht
; mov esi,searchtl-searcht
; int 0x40
 
 
 
; ****************************
; ******* READ STRING ********
; ****************************
goto_string:
 
mov [num_goto_string],0
call read_str_num
mov eax,[num_goto_string]
cmp eax,[lines]
ja .leave
 
;---------------
mov [posy],0
call goto_pos
 
.leave:
call draw_window_for_dialogs
call mask_events
 
jmp still
 
 
read_str_num:
push eax
;----------------
mov eax,40
mov ebx,00000000000000000000000000000111b
int 0x40
;----------------
pop eax
 
mov eax,13
mov ebx,100*65536+100
mov ecx,70*65536+60
mov edx,[sc.work_button]
int 0x40
 
 
mov eax,38
mov ebx,100*65536+200
mov ecx,70*65536+70
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,100*65536+200
mov ecx,130*65536+130
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,100*65536+100
mov ecx,70*65536+130
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,200*65536+200
mov ecx,70*65536+130
mov edx,cl_White
int 0x40
 
 
 
putlabel 105,75,'GoTo Line #',cl_White
mov eax,13
mov ebx,110*65536+40
mov ecx,90*65536+12;[ya]
mov edx,[sc.work]
int 0x40
 
outcount [num_goto_string],112,92,cl_Black,6*65536
drawlbut 110,105,40,15,'GoTo',93,cl_Grey,cl_Black
drawlbut 153,105,40,15,'Cancel',94,cl_Grey,cl_Black
.waitev:
mov eax, 10
int 0x40
; cmp eax,6
; je .mouse
cmp eax,3
je .but
cmp eax, 2
; jne .read_done
jne .waitev
int 0x40
shr eax, 8
 
cmp al, 13 ; enter
je .read_done
cmp al,27
je goto_string.leave
cmp al, 8 ; backspace
jnz .nobsl
 
xor edx,edx
 
mov eax,[num_goto_string]
mov ebx,dword 10
div ebx
mov [num_goto_string],eax
call print_text2
jmp .waitev
 
;.mouse:
;mov eax,37
;mov ebx,2
;int 0x40
;cmp eax,2
;je goto_string.leave
;jmp .waitev
 
.but:
mov eax,17
int 0x40
cmp ah,94
je goto_string.leave
cmp ah,93
je .read_done
jmp .waitev
 
 
.nobsl:
xor ecx,ecx
xor edx,edx
 
sub al,48
mov cl,al
 
mov eax,[num_goto_string]
cmp eax,99999
ja .read_done
mov ebx,10
mul ebx
add eax,ecx
mov [num_goto_string],eax
 
call print_text2
jmp .waitev
 
.read_done:
mov eax,[num_goto_string]
dec eax
mov [num_goto_string],eax
call print_text2
ret
 
 
print_text2:
 
pusha
 
mov eax,13
mov ebx,110*65536+40
mov ecx,90*65536+12;[ya]
mov edx,[sc.work]
int 0x40
 
outcount [num_goto_string],112,92,cl_Black,6*65536
popa
 
ret
 
;******************************************************************************
calc_scroll_size_and_pos:
 
;cmp [menu_is_on],0
;je ._ff
;call drawwindow
;mov [menu_is_on],0
;._ff:
 
cmp [lines],30
jbe .lines_less_30
 
xor edx,edx
mov eax,[post]
mov ebx,80
div ebx
add eax,[posy]
;add eax,[slines]
 
;checking for bug
mov ebx,[lines]
sub ebx,30
 
cmp eax,ebx
ja .f
mov [VScroll_1+16],eax
jmp .ff
.f:
mov [VScroll_1+16],ebx
 
.ff:
;---------------------
mov eax,[lines]
sub eax,30 ;---max=lines-30
mov [VScroll_1+12],eax
jmp .leave
 
.lines_less_30:
 
mov [VScroll_1+16],dword 0
mov [VScroll_1+12],dword 1
 
.leave:
 
ret
;============Draw vertical scroll bar=========
draw_vertical_scroll:
call calc_scroll_size_and_pos
;========================
xor ecx,ecx ;start at top of controls list
Draw_Controls_Loop: ;Redraw Controls Loop
mov ebp, [App_Controls+ecx] ;get controls data location
or ebp,ebp ;is this the last control?
jz Draw_Controls_Done ;
call dword [App_Controls+ecx+4] ;call controls draw function
add ecx, 12 ;get next control
jmp Draw_Controls_Loop ;loop till done
Draw_Controls_Done: ;all done
;========================
 
mov eax,38
mov ebx,488*65536+488
mov ecx,43*65536+388
mov edx,0x00000000
int 0x40
ret
 
mouse_info:
;call
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 ;
;------------------
; if menu is on - then we need to redraw window before continue
cmp eax,1
jne ._f1
 
pusha
cmp [menu_is_on],0
je ._ff
call drawwindow
mov [menu_is_on],0
._ff:
popa
 
._f1:
;------------------
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]
;------------------------------
cmp [mouseb],1
jne mouse_not_on_control
mov eax,[VScroll_1+16]
call goto_pos
;------------------------------
 
mouse_not_on_control:
add ecx, 12
jmp Check_Mouse_Over_Controls_Loop
Check_Mouse_Over_Controls_Loop_done:
 
ret
;******************************************************************************
goto_pos:
;pusha
 
mov ecx,eax ;save new position number in ecx for future
 
cmp [lines],30 ;check for 'cursor' bug
jbe .lines_less_30
;---------------
 
mov edx,[lines] ;if new pos is > than (lines-30)
sub edx,30
 
cmp eax,edx
ja .f1
jmp .ff
 
.f1:
mov eax,edx ;than newpos is = (lines-30)
 
sub ecx,edx ;and posY=newpos-(lines-30)
mov [posy],ecx
 
.ff:
 
;-----------------------
;in eax must be string number
mov ecx,80
mul ecx
 
; add eax,[slines]
; sub
;------------------------
mov [post],eax
 
.lines_less_30:
call clear_screen
call drawfile
;popa
ret
;******************************************************************************
mask_events:
mov eax,40
mov ebx,00100111b
int 0x40
ret
;******************************************************************************
main_cursor_move:
;call drawwindow
sub [mouse_x],7
sub [mouse_y],45
 
xor edx,edx
mov eax,[mouse_x]
mov ebx,6
div ebx ;eax=result
mov [posx],eax
 
xor edx,edx
mov eax,dword [mouse_y]
mov ebx,dword 10
div ebx ;eax=result=new posY
 
;error checking ------
cmp [lines],dword 1 ;for "1st line" bug
je ._do_nothing
 
mov ebx,[lines]
sub ebx,dword 1
 
cmp eax,ebx ;[lines]
ja ._do_nothing
 
;----------------------
mov [posy],eax
 
._do_nothing:
call clear_screen
call drawfile
call draw_vertical_scroll
ret
 
;******************************************************************************
make_fast_so:
;===========================
; 1) get info about me
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
; eax = number of processes
 
; save process counter
inc eax
inc eax
mov [proccount],eax
 
mov eax,[procinfo.PID]
mov [PID],eax
;==========================
 
 
mov eax,51
mov ebx,1
mov ecx,fast_so_thread_start
mov edx,so_stack
int 0x40
ret
;******************************************************************************
 
;fast save & fast open
draw_fastso_window:
startwd
colorwindow 120,100,454,70,window_Type1+0x00cccccc,0x00cccccc,cl_Black
 
call draw_string00
drawlbut 10,40,30,20,'Save',17,cl_Grey,cl_Black
 
drawlbut 50,40,30,20,'Open',18,cl_Grey,cl_Black
 
drawlbut 90,40,37,20,'Close',19,cl_Grey,cl_Black
endwd
ret
 
draw_string00:
mov ebx,10*65536+433
mov ecx,10*65536+20
mov edx,0x00ffffff
mov eax,13
int 0x40
 
push eax
mov eax,6*65536
mul dword [pos00]
add eax,10*65536+6
mov ebx,eax
pop eax
mov edx,0x6a73d0
int 0x40
 
mov eax,4
mov ebx,12*65536+17
mov ecx,cl_Black ;0x00000000
mov edx,mypath ;filename ;path
mov esi,71 ;200
int 0x40
ret
 
fast_so_thread_start:
;copy filename to mypath
cld
mov esi,filename
mov edi,mypath
mov ecx,71 ;200
rep movsb
mov edi,mypath
mov ecx,71 ;200
xor eax,eax
repne scasb
;end copy
call draw_fastso_window
 
fastso_still:
wtevent fred,fkey,fbut
jmp fastso_still
 
fred:
call draw_fastso_window
jmp fastso_still
 
;====KEY
fkey:
 
mov eax,2
int 0x40
 
cmp ah,179
jne noright00
mov eax,[pos00]
cmp eax,70 ;41
ja fastso_still
inc eax
mov [pos00],eax
call draw_string00
jmp fastso_still
noright00:
cmp ah,176
jne noleft00
mov eax,[pos00]
test eax,eax
je fastso_still
dec eax
mov [pos00],eax
call draw_string00
jmp fastso_still
noleft00:
cmp ah,182
jne nodelete00
call shiftback00
call draw_string00
jmp fastso_still
nodelete00:
cmp ah,8
jne noback00
mov eax,[pos00]
test eax,eax
je fastso_still
dec eax
mov [pos00],eax
call shiftback00
call draw_string00
jmp fastso_still
noback00:
enter00:
 
cmp ah,19 ;ctrl+s
je fast_save
cmp ah,15 ;ctrl+o
je fast_open
 
cmp ah,27 ;esli escape
jne noesc00
jmp closethis ;to zakrivaem okno i nifiga ne delayem
 
noesc00:
cmp dword [pos00],71 ;200 ;42
jae fastso_still ;if pos>71 then jump to still
 
;============letters==================
;~~~~~~~TEST CODE~~~~~~~~~
; upper case
shr eax,8
cmp eax,dword 31
jbe no_lit
cmp eax,dword 95
jb capital
sub eax,32
capital:
;~~~~~~~~~~~~~~~~~~~~~~~~~
mov edi,mypath ;filename ;mypath ;**************PATHNAME
add edi,71 ;200 ;count of letters
mov esi,edi
dec esi
mov ecx,71 ;200 ;again???
sub ecx,[pos00]
std
rep movsb
 
;shr eax,8
mov esi,mypath ;filename ;*************PATH AGAIN
add esi,[pos00]
mov byte [esi],al
inc dword [pos00]
call draw_string00
 
no_lit:
jmp fastso_still
;===============================
shiftback00:
mov edi,mypath ;filename ;******PATH
add edi,[pos00]
mov esi,edi
inc esi
mov ecx,71 ;200 ; count???
sub ecx,[pos00]
cld
rep movsb
ret
 
;******************************************************************************
 
;====button
fbut:
mov eax,17
int 0x40
cmp ah,17
je fast_save
cmp ah,18
je fast_open
cmp ah,19
je closethis
jmp fastso_still
;******************************************************************************
;******************************************************************************
 
fast_open:
call path_copy
call set_title
mov [to_return],1
call do_load_file
jmp closethis
fast_save:
call path_copy
call save_file
call set_title
;call copy_fpath_s
closethis:
mov [to_return],0
cmp [error_found],1
je @f
call activate_main
@@:
mov [error_found],0
close
 
 
activate_main:
mov eax,9
mov ebx,procinfo
mov ecx,[proccount]
@@:
dec ecx
jz @f ; counter=0 => not found? => return
mov eax,9
int 0x40
mov edx,[procinfo.PID]
cmp edx,[PID]
jne @b
 
;found: ecx = process_number
mov eax,18
mov ebx,3
int 0x40
 
mov eax,5
mov ebx,eax
int 0x40
 
@@:
ret
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
doyouwannasave:
;******************************************************************************
cmp [modified],0
je newfile
mov eax,55 ; beep
mov ebx,eax
mov esi,save_beep1
int 0x40
delay 4
mov eax,55 ; beep
mov ebx,eax
mov esi,save_beep2
int 0x40
 
mov eax,13
mov ebx,150*65536+200
mov ecx,100*65536+70
mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
int 0x40
 
mov eax,38
mov ebx,150*65536+350
mov ecx,100*65536+100
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,150*65536+350
mov ecx,170*65536+170
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,150*65536+150
mov ecx,100*65536+170
mov edx,cl_White
int 0x40
mov eax,38
mov ebx,350*65536+350
mov ecx,100*65536+170
mov edx,cl_White
int 0x40
 
 
putlabel 190,120,'‘®åà ­¨âì ¤®ªã¬¥­â?',cl_White
 
drawlbut 170,140,30,15,'„ ',46,[sc.work_button],cl_White
drawlbut 230,140,30,15,'¥â',45,[sc.work_button],cl_White
drawlbut 290,140,45,15,'Žâ¬¥­ ',47,[sc.work_button],cl_White
 
mov [exit_wnd_on],1
jmp still
;-------------
newfile:
;if filename is not NEWDOC## than change it to it!
mov eax,dword [orig_filename]
cmp dword [filename],eax ;[orig_filename]
je @f
cld
mov esi,orig_filename
mov edi,filename
mov ecx,71 ;50
rep movsb
mov edi,filename
mov ecx,71 ;50
xor eax,eax
repne scasb
sub edi,filename
dec edi
mov [filename_len],edi
 
@@:
 
call change_fname
call set_title
call draw_window_for_dialogs
call empty_work_space
mov [lines],1
jmp do_load_file.restorecursor
 
change_fname:
cmp [filename+7],'9'
jne addfname
cmp [filename+6],'9'
je error_creating_new_file
mov [filename+7],'0'
add [filename+6],0x1
jmp leavenow
addfname:
add [filename+7],0x1
leavenow:
ret
 
set_title:
cmp [error2_found],1
je no_set_title
mov esi, filename
mov edi, header
mov ecx, [filename_len]
mov eax, ecx
add eax, 10
mov [headlen], eax
cld
rep movsb
 
mov [edi], dword ' - '
add edi, 3
mov esi, htext
mov ecx, htext.size
rep movsb
 
call drawwindow
no_set_title:
mov [error2_found],0
ret
 
draw_window_for_dialogs:
call clear_screen
call drawwindow
ret
 
copy_fpath:
call mask_events
call path_copy
call set_title
call draw_window_for_dialogs
jmp do_load_file
 
copy_fpath_s:
call mask_events
call path_copy
call save_file
call set_title
call draw_window_for_dialogs
jmp still
 
path_copy:
cld
mov esi,mypath
mov edi,filename
mov ecx,250 ;71 ;50
rep movsb
mov edi,filename
mov ecx,250 ;71 ;50
xor eax,eax
repne scasb
sub edi,filename
dec edi
mov [filename_len],edi
ret
 
openerror:
mov eax,360
mov ebx,openerrtext
mov ecx,1
call alert_box
 
cmp [to_return2],1
jne jmp_to_still
mov [to_return2],0
mov [error_found],1
call mask_events
 
ret
 
saveerror:
mov eax,390
mov ebx,saveerrtext
mov ecx,1
call alert_box
cmp [to_return2],0
je jmp_to_still
mov [to_return2],0
mov [error_found],1
call mask_events
ret
;jmp still
jmp_to_still:
call mask_events
jmp still
 
error_creating_new_file:
mov eax,200
mov ebx,newfileerror
mov ecx,1
call alert_box
jmp still
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;MENU;;;;;;;;;;;;;;;;;;;;;;
draw_win_menu:
 
;mov eax,8
;mov ebx,145*65536+276
;mov ecx,22*65536+15
;mov edx,00100000000000000000000000001111b
;mov esi,0x00aaaaaa
;int 0x40
 
mov eax,13
mov ebx,5*65536+497
mov ecx,22*65536+17
mov edx,[sc.work_graph] ;0x00999999
int 0x40
mov ecx,39*65536+5
mov edx,0x00aaaaaa
int 0x40
 
drawlbut 5,22,70,15,'” ©«',97,[sc.work_button],[sc.work_button_text]
drawlbut 75,22,70,15,'Š®¤',98,[sc.work_button],[sc.work_button_text]
drawlbut 145,22,70,15,'’¥ªáâ',96,[sc.work_button],[sc.work_button_text]
drawlbut 431,22,70,15,'‘¯à ¢ª ',99,[sc.work_button],[sc.work_button_text]
 
ret
 
draw_win_menu_file:
call clear_screen
call drawwindow
;mov eax,13
;mov ebx,5*65536+71
;mov ecx,35*65536+90
;mov edx,[sc.grab_button];0x00999999
;int 0x40
;mov eax,38
;mov ebx,5*65536+35
;mov ecx,40*65536+47
;mov edx,0x00ff0000
;int 0x40
mov [menu_is_on],1
 
drawlbut 5,38,70,15,'®¢®¥ ®ª­®',100,[sc.grab_button],[sc.grab_button_text]
drawlbut 5,53,70,15,'®¢ë©',101,[sc.grab_button],[sc.grab_button_text]
drawlbut 5,68,70,15,'‘®åà ­¨âì',2,[sc.grab_button],[sc.grab_button_text]
drawlbut 5,83,70,15,'‘®åà. ª ª',102,[sc.grab_button],[sc.grab_button_text]
drawlbut 5,98,70,15,'Žâªàëâì',103,[sc.grab_button],[sc.grab_button_text]
drawlbut 5,113,70,15,'‚ë室',104,[sc.grab_button],[sc.grab_button_text]
jmp still
 
draw_win_menu_code:
call clear_screen
call drawwindow
drawlbut 75,38,70,15,'Š®¬¯¨«.',10000,[sc.grab_button],[sc.grab_button_text]
drawlbut 75,53,70,15,'‡ ¯ãáâ¨âì',10001,[sc.grab_button],[sc.grab_button_text]
drawlbut 75,68,70,15,'„®áª  ®â«.',10002,[sc.grab_button],[sc.grab_button_text]
drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text]
mov [menu_is_on],1
jmp still
 
draw_win_menu_text:
call clear_screen
call drawwindow
drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text]
drawlbut 145,53,70,15,' ©â¨',92,[sc.grab_button],[sc.grab_button_text]
drawlbut 145,68,70,15,' ©â¨ ¤ «¥¥',50,[sc.grab_button],[sc.grab_button_text]
mov [menu_is_on],1
jmp still
 
new_pad_wnd:
mov eax,19
mov ebx,tinypad_filename
mov ecx,0
int 0x40
jmp still
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
openerrtext db 'Žè¨¡ª  ®âªàëâ¨ï ä ©«  ¨«¨ ®âªàë⨥ ®â¬¥­¥­®!',0
saveerrtext db 'Žè¨¡ª  á®åà ­¥­¨ï ä ©«  ¨«¨ á®åà ­¥­¨¥ ®â¬¥­¥­®!',0
newfileerror db '¥¢®§¬®¦­® á®å¤ âì ­®¢ë© ä ©«',0
; ********************
; ****** DATA ******
; ********************
sz fasm_filename, 'FASM '
sz debug_filename, 'BOARD '
sz tinypad_filename, 'TINYPAD '
 
lsz sysfuncs_filename,\
ru, <'SYSFUNCR.TXT',0>,\
en, <'SYSFUNCS.TXT',0>
 
sz setup, 'SETUP ' ; we need to run SETUP to change keyboard layout
param_setup db 'LANG',0 ; parameter for SETUP
 
 
addr dd filename ; address of input string
 
filename_len dd 12
filename db 'NEWDOC00.TXT'
times 256 db 0;51-12 db 0
;times db 0 ; ï ­¥ §­ î ¯®ç¥¬ã ‚¨«« ­¥ ¯®áâ ¢¨« íâã áâà®çªã
orig_filename db 'NEWDOC00.TXT'
rb 256
search_len dd 5
search_string db 'still'
times 51-5 db 0
 
case_sens db 0 ; for search function
 
align 4
comment_string:
db ';***************************************'
db '*************************************** '
 
 
 
; INTERFACE DATA:
 
 
sz htext, 'TINYPAD'
;sz toolbar_btn_text, 'COMPILE RUN BOARD SYSFUNC'
 
 
searcht:
if lang eq ru
db ' ‘’ŽŠ€ > '
db ' Žˆ‘Š '
else
db ' STRING > '
db ' SEARCH '
end if
searchtl:
 
 
htext2:
if lang eq ru
db ' Ž‡ˆ–ˆŸ 00:00000 „‹ˆ€ 00000 ‘’ŽŠ '
else
db 'POSITION 00:00000 LENGTH 00000 LINES '
end if
htextlen2:
 
help_text:
if lang eq ru
db ' ŠŽŒ€„›: '
db ' '
db ' CTRL+F1 : â® ®ª­® '
db ' CTRL+S : ¥à¢ ï áâப  ¤«ï ª®¯¨à®¢ ­¨ï '
db ' CTRL+E : ®á«¥¤­ïï áâப  ¤«ï ª®¯¨à®¢ ­¨ï '
db ' CTRL+P : ‚áâ ¢¨âì ¢ë¡à ­­®¥ ­  ⥪ãéãî ¯®§¨æ¨î '
db ' CTRL+D : “¤ «¨âì áâபã '
db ' CTRL+L : ‚áâ ¢¨âì áâபã-à §¤¥«¨â¥«ì '
db ' CTRL+[ : ¥à¥©â¨ ¢ ­ ç «® ä ©«  '
db ' CTRL+] : ¥à¥©â¨ ¢ ª®­¥æ ä ©«  '
db ' CTRL+F2 : ‡ £à㧨âì ä ©« '
db ' CTRL+F3 : ®¨áª '
db ' CTRL+F4 : ‘®åà ­¨âì ä ©« '
db ' CTRL+F5 : ‘®åà ­¨âì ä ©« ª ª... '
db ' CTRL+F6 : ‚¢¥á⨠áâப㠤«ï ¯®¨áª  '
db ' CTRL+F7 : "Žª­® ¡ëáâண® á®åà ­¥­¨ï ¨ § £à㧪¨" '
db ' CTRL+F8 : ‘¬¥­¨âì à áª« ¤ªã ª« ¢¨ âãàë '
db ' CTRL+F9 : Š®¬¯¨«¨à®¢ âì ä ©« '
db ' CTRL+F10 : Š®¬¯¨«¨à®¢ âì ¨ § ¯ãáâ¨âì '
db ' F12 : ‡ ¯ãáâ¨âì ¤®áªã ®â« ¤ª¨ '
db 'x'
else
db ' COMMANDS: '
db ' '
db ' CTRL+F1 : SHOW THIS WINDOW '
db ' CTRL+S : SELECT FIRST STRING TO COPY '
db ' CTRL+E : SELECT LAST STRING TO COPY '
db ' CTRL+P : PASTE SELECTED TO CURRENT POSITION '
db ' CTRL+D : DELETE CURRENT LINE '
db ' CTRL+L : INSERT SEPARATOR LINE '
db ' CTRL+[ : GO TO THE BEGINNING OF FILE '
db ' CTRL+] : GO TO THE END OF FILE '
db ' CTRL+F2 : LOAD FILE '
db ' CTRL+F3 : SEARCH '
db ' CTRL+F4 : SAVE FILE '
db ' CTRL+F5 : SAVE FILE AS... '
db ' CTRL+F6 : ENTER SEARCH STRING '
db ' CTRL+F7 : DRAW "FAST SAVE AND OPEN" WINDOW '
db ' CTRL+F8 : CHANGE KEYBOARD LAYOUT '
db ' CTRL+F9 : COMPILE FILE '
db ' CTRL+F10 : RUN OUTFILE '
db ' F12 : OPEN DEBUG BOARD '
db 'x'
end if
 
help_wnd_header:
if lang eq ru
db 'ŽŒŽ™œ',0
else
db 'TINYPAD HELP',0
end if
 
hlphead_len = $ - help_wnd_header
 
save_yes_no:
if lang eq ru
db '‘®åà ­¨âì ä ©« ¯¥à¥¤ ¢ë室®¬?',0
else
db 'Save file before exit?',0
end if
 
VScroll_1:
dw 13 ;width +0
dw 489 ;x +2
dw 341 ;326 ;height +4
dw 43 ;y +6
dd 0 ;min +8
dd 100 ;scrl_max ;lines ;max +12
dd 0 ;cur_pos ;current +16
dd 1 ;small change +20
dd 10 ;big change +24
 
App_Controls:
dd VScroll_1 , drawvscroll, VScroll_mouse_over ;
dd 0,0,0 ;last control do not delete
 
; END OF INTERFACE DATA
 
symbols db '%#&*\:/<>|{}()[]=+-,. '
 
error_beep:
db 0xA0,0x30,0
save_beep1:
db 0x84,0x43,0
save_beep2:
db 0x84,0x48,0
 
 
align 4
fileinfo_read:
dd 0
dd 0
dd 300000/512
dd 0x10000
dd 0x70000
pathfile_read:
times 250 db 0 ;51 db 0
 
align 4
fileinfo_write:
dd 1
dd 0
dd 0
dd 0x10000
dd 0x70000
pathfile_write:
times 250 db 0 ; 51 db 0
 
align 4
 
temp dd 0xabc ; used in read_string
d_status dd 0
 
color_tbl:
dd 0x00000000 ; text
dd 0x00000000 ; instruction
dd 0x00000000 ; register
dd 0x00009000 ; number
dd 0x00a00000 ; quote
dd 0x00909090 ; comment
dd 0x003030f0 ; symbol
 
 
next_not_quote2 db 0 ; "
next_not_quote db 0 ; '
quote db 0
asm_mode db 0 ; ASM highlight?
tmpabc db 0
 
 
I_PARAM db 0 ; parameters are HERE - ¯ à ¬¥âàë ¡ã¤ãâ ­ ç¨­ âìáï ‡„…‘œ!
TINYPAD_END: ; end of file
 
 
; Uninitialised data
; ¥¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥
align 4
 
posx dd ? ; x ­  íªà ­¥ (on the screen)
posy dd ? ; y ­  íªà ­¥
post dd ? ; ᬥ饭¨¥ ®â ­ ç «  - offset
posl dd ?
lines dd ? ; ª®«¨ç¥á⢮ áâப ¢ ¤®ªã¬¥­â¥
posxm dd ?
posym dd ?
 
dstart dd ? ; ᬥ饭¨¥ ¯® ®á¨ y ¤«ï ®âà¨á®¢ª¨ ª­®¯®ª ¨ ¤à.
 
filelen dd ? ; ¤«¨­  ä ©« 
 
PID dd ? ; ¨¤¥­â¨ä¨ª â®à ¯à®æ¥áá 
proccount dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ
 
filesize dd ? ; à §¬¥à ä ©« 
ya dd ? ; ¤«ï read_string
slines dd ? ; number of strings on the screen - ª®«¨ç¥á⢮ áâப ­  íªà ­¥
 
run_outfile dd ? ; for FASM
copy_start dd ? ; Ctrl+S
copy_count dd ? ; Ctrl+E
headlen dd ? ; header length
do_not_draw dd ? ; to draw or not to draw - this is a serious question ;)
 
MainWndClosed dd ?
sc system_colors
 
to_return db 0
to_return2 db 0
error_found db 0
error2_found db 0
 
header: ; window header - § £®«®¢®ª ®ª­ 
rb 256
 
; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áᥠ§ ¯¨á뢠¥âáï ¢ íâã áâàãªâãàã
procinfo process_information
 
virtual at procinfo
fasm_parameters rb 256
end virtual
pos00 dd 0
newdoc db ?
mypath:
times 258 db 0
real_posy dd 0
vscroll_size dd 0
vscroll_pos dd 0
cur_pos dd 0
scrl_max dd 100
 
mouse_x dd 0
mouse_y dd 0
mousey dw 0
mousex dw 0
mouseb dd 0
 
num_goto_string dd 0
 
menu_is_on db 0
exit_wnd_on db 0
modified db 0
;fast save n open stack
rb 1024
so_stack:
;growing down
; the end!
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/transp/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm transp.asm transp
@pause
/programs/transp/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm transp.asm transp
@pause
/programs/transp/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/transp/trunk/transp.asm
0,0 → 1,222
;
; TRANSPARENT 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 0x30000 ; memory for app
dd 0x30000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
include 'macros.inc'
 
START: ; start of execution
mov [procinfo.x_start], 100
mov [procinfo.x_size], 200
mov [procinfo.y_start], 80
mov [procinfo.y_size], 300
 
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 get_transparent
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,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,[procinfo.x_start]
shl ebx,16
add ebx,[procinfo.x_size]
dec ebx
mov ecx,[procinfo.y_start]
shl ecx,16
add ecx,[procinfo.y_size]
dec ecx
mov edx,0x03000000 ; color of work area RRGGBB,8->color gl
int 0x40
 
call draw_transparent
; 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
 
; call draw_transparent
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
 
 
draw_transparent:
 
pusha
 
mov eax,7
mov ebx,0x1000
mov ecx,[procinfo.x_size]
shl ecx,16
add ecx,[procinfo.y_size]
mov edx,4*65536+22
int 0x40
 
popa
ret
 
 
get_transparent:
 
pusha
 
mov eax,9
mov ebx,I_END
mov ecx,-1
int 0x40
; mov eax,[I_END+34]
; mov [x_start],eax
; mov eax,[I_END+38]
; mov [y_start],eax
 
mov eax,14
int 0x40
 
shr eax,16
inc eax
mov [scx],eax
 
add [procinfo.x_start], 4
sub [procinfo.x_size], 4+4
add [procinfo.y_start], 22
sub [procinfo.y_size], 22+4
 
mov eax,[procinfo.x_start]
add eax,[procinfo.x_size]
mov [x_end],eax
mov eax,[procinfo.y_start]
add eax,[procinfo.y_size]
mov [y_end],eax
 
mov eax,[procinfo.x_start]
mov ebx,[procinfo.y_start]
 
dtpl1:
 
push eax
push ebx
 
imul ebx,[scx]
add ebx,eax
mov eax,35
int 0x40
 
; shr eax,1
; and eax,0x7f7f7f
or eax, 0x4e4e4e
 
mov ebx,[esp+4]
mov ecx,[esp]
sub ebx,[procinfo.x_start]
sub ecx,[procinfo.y_start]
imul ecx,[procinfo.x_size]
imul ebx,3
imul ecx,3
add ebx,ecx
mov [0x1000+ebx],eax
 
pop ebx
pop eax
 
inc eax
cmp eax,[x_end]
jb dtpl1
mov eax,[procinfo.x_start]
inc ebx
cmp ebx,[y_end]
jb dtpl1
 
popa
 
ret
 
 
 
 
; DATA AREA
 
;x_start dd 100
;y_start dd 80
 
;x_size dd 160
;y_size dd 200
 
x_end dd 0
y_end dd 0
 
scx dd 640
 
labelt:
db 'EXAMPLE APPLICATION'
labellen:
 
I_END:
procinfo process_information
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/trantest/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 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 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:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/trantest/trunk/ascl.inc
0,0 → 1,838
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 0 & loword eqtype [123]
mov reg,(hiword)*65536
add reg,loword
else if (hiword eq ) & (loword eq )
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
if ~(arg4 eq )
mov ecx,arg4 ;arg4 color
end if
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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/trantest/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm trantest.asm trantest
@pause
/programs/trantest/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm trantest.asm trantest
@pause
/programs/trantest/trunk/trantest.asm
0,0 → 1,333
;
; TRIANGLE SPEED TEST 3
; 32 triangle draw use! 12300 triangle in sec on 800Mhz processor
;
; Pavlushin Evgeni 11.09.2004
; mail: waptap@mail.ru site: www.deck4.narod.ru
; www.cyberdeck.fatal.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 0x2000000 ; memory for app
dd 0x2000000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
SCREEN_X equ 320 ;800
SCREEN_Y equ 200 ;600
 
include 'lang.inc'
include 'ascl.inc'
include 'ascgl.inc'
 
START:
call draw_window
 
still:
scevent red,key,button
fps 280,8,cl_White,cl_Black
 
main_loop:
random SCREEN_X,eax
mov [@@tx1],eax
random SCREEN_Y,eax
mov [@@ty1],eax
random SCREEN_X,eax
mov [@@tx2],eax
random SCREEN_Y,eax
mov [@@ty2],eax
random SCREEN_X,eax
mov [@@tx3],eax
random SCREEN_Y,eax
mov [@@ty3],eax
 
random 255,eax
mov byte [@@rgb],al
random 255,eax
mov byte [@@rgb+1],al
random 255,eax
mov byte [@@rgb+2],al
pushad
call filled_triangle
popad
 
dec [count] ;for max speed
jnz xxx
call outscr
mov [count],100
xxx:
jmp still
 
count dd 100
 
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:
 
outscr:
 
;outscrbuf
mov ebx,scrbuf
mov ecx,SCREEN_X*65536+SCREEN_Y
mov edx,5*65536+22
mov ax,7
int 0x40
 
ret
 
;filled trangle 32 bit draw procedure
;from NAAG3d demo
 
@@tx1 dd 0
@@ty1 dd 0
@@tx2 dd 0
@@ty2 dd 0
@@tx3 dd 0
@@ty3 dd 0
@@rgb dd 0
 
@@dx12 dd 0
@@dx13 dd 0
@@dx23 dd 0
 
filled_triangle:
mov eax,[@@ty1]
cmp eax,[@@ty3]
jle @@ok13
 
xchg eax,[@@ty3]
mov [@@ty1],eax
 
mov eax,[@@tx1]
xchg eax,[@@tx3]
mov [@@tx1],eax
@@ok13:
mov eax,[@@ty2]
cmp eax,[@@ty3]
jle @@ok23
 
xchg eax,[@@ty3]
mov [@@ty2],eax
 
mov eax,[@@tx2]
xchg eax,[@@tx3]
mov [@@tx2],eax
@@ok23:
mov eax,[@@ty1]
cmp eax,[@@ty2]
jle @@ok12
 
xchg eax,[@@ty2]
mov [@@ty1],eax
 
mov eax,[@@tx1]
xchg eax,[@@tx2]
mov [@@tx1],eax
@@ok12:
 
mov ebx,[@@ty2]
sub ebx,[@@ty1]
jnz @@make_d12
 
mov [@@dx12],dword 0
jmp @@done_d12
@@make_d12:
mov eax,[@@tx2]
sub eax,[@@tx1]
shl eax,12 ;7
cdq
idiv ebx
mov [@@dx12],eax ; dx12 = (x2-x1)/(y2-y1)
@@done_d12:
 
mov ebx,[@@ty3]
sub ebx,[@@ty1]
jnz @@make_d13
 
mov [@@dx13],dword 0
jmp @@done_d13
@@make_d13:
mov eax,[@@tx3]
sub eax,[@@tx1]
shl eax,12 ;7
cdq
idiv ebx
mov [@@dx13],eax ; dx13 = (x3-x1)/(y3-y1)
@@done_d13:
 
mov ebx,[@@ty3]
sub ebx,[@@ty2]
jnz @@make_d23
 
mov [@@dx23],dword 0
jmp @@done_d23
@@make_d23:
mov eax,[@@tx3]
sub eax,[@@tx2]
shl eax,12 ;7
cdq
idiv ebx
mov [@@dx23],eax ; dx23 = (x3-x2)/(y3-y2)
@@done_d23:
 
mov eax,[@@tx1]
shl eax,12 ;7
mov ebx,eax
 
mov ecx,[@@ty1]
cmp ecx,[@@ty2]
jge @@end_loop12
 
@@loop12:
 
call flat_line
 
add eax,[@@dx13]
add ebx,[@@dx12]
inc ecx
cmp ecx,[@@ty2]
jl @@loop12
@@end_loop12:
 
mov ecx,[@@ty2]
cmp ecx,[@@ty3]
jge @@end_loop23
mov ebx,[@@tx2]
shl ebx,12 ;7
@@loop23:
 
call flat_line
 
add eax,[@@dx13]
add ebx,[@@dx23]
inc ecx
cmp ecx,[@@ty3]
jl @@loop23
@@end_loop23:
 
ret
 
;flatline proc
 
flat_line:
push eax
push ebx
push ecx
 
or ecx,ecx
jl @@quit
cmp ecx,SCREEN_Y-1 ;199
jg @@quit
 
sar eax,12
sar ebx,12
 
or eax,eax
jge @@ok1
xor eax,eax
jmp @@ok2
@@ok1:
cmp eax,SCREEN_X-1 ;319
jle @@ok2
mov eax,SCREEN_X-1 ;319
@@ok2:
or ebx,ebx
jge @@ok3
xor ebx,ebx
jmp @@ok4
@@ok3:
cmp ebx,SCREEN_X-1 ;319
jle @@ok4
mov ebx,SCREEN_X-1 ;319
@@ok4:
cmp eax,ebx
jl @@ok
je @@quit
 
xchg eax,ebx
@@ok:
mov edi,ecx
 
; shl edi,6 ;for 320 speed+
; shl ecx,8
; add edi,ecx
 
push eax
mov eax,SCREEN_X
mul edi
mov edi,eax
pop eax
 
add edi,eax
 
mov ebp,edi
shl ebp,1
add edi,ebp
 
add edi,scrbuf
 
mov ecx,ebx
sub ecx,eax
 
lineout:
mov eax,[@@rgb]
mov byte [edi],al
shr eax,8
mov byte [edi+1],al
shr eax,8
mov byte [edi+2],al
add edi,3
dec ecx
jnz lineout
 
@@quit:
pop ecx
pop ebx
pop eax
ret
 
scrbuf:
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tube/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tube.asm tube
@pause
/programs/tube/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tube.asm tube
@pause
/programs/tube/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/tube/trunk/tube.asm
0,0 → 1,277
 
; (Ü) ( ) Ü ) ( ) 256b intro by baze/3SC for Syndeecate 2001 use NASM to
; ßÛß ÛÜÛ ÛÛÛ ÛÛÜ loveC: thanks, Serzh: eat my socks dude ;] compile the
; ( ) ( ) ( ) ( ) e-mail: baze@stonline.sk, web: www.3SC.sk source code
 
; Menuet port by VT
 
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x40000
dd 0x3ff00
dd 0,0
 
include 'macros.inc'
 
START:
 
call draw_window
 
call init_tube
 
push ebx
 
still:
 
pop ebx
 
call MAIN
 
push ebx
 
mov eax,23
mov ebx,1
int 0x40
 
cmp eax,1
jne no_red
call draw_window
jmp still
no_red:
 
cmp eax,0
je still
 
mov eax,-1
int 0x40
 
 
SCREEN equ 160
PIXBUF equ 200h
EYE equ EYE_P-2
 
 
MAIN:
 
add bh,10;8
mov edi,PIXBUF
fadd dword [di-PIXBUF+TEXUV-4]
push di
mov dx,-80
 
TUBEY:
 
mov bp,-160
 
TUBEX:
 
mov si,TEXUV
fild word [si-TEXUV+EYE]
mov [si],bp
fild word [si]
mov [si],dx
fild word [si]
mov cl,2
 
ROTATE:
 
fld st3
fsincos
fld st2
fmul st0,st1
fld st4
fmul st0,st3
db 0xde,0xe9 ; fsubp st1,st0
db 0xd9,0xcb ; fxch st3
fmulp st2,st0
fmulp st3,st0
faddp st2,st0
db 0xd9,0xca ; fxch st2
 
loop ROTATE
 
fld st1
db 0xdc,0xc8 ; fmul st0,st
fld st1
db 0xdc,0xc8 ; fmul st0,st
faddp st1,st0
fsqrt
db 0xde,0xfb ; fdivp st3,st0
fpatan
fimul word [si-4]
fistp word [si]
fimul word [si-4]
fistp word [si+1]
mov si,[si]
 
lea ax,[bx+si]
add al,ah
and al,64
mov al,-5
jz STORE_1
 
shl si,2
lea ax,[bx+si]
sub al,ah
mov al,-16
jns STORE_1
 
shl si,1
mov al,-48
 
STORE_1:
 
; add al,[ebx+esi+0x80000]
add [di],al
inc di
 
inc bp
cmp bp,160
 
EYE_P:
 
jnz TUBEX
inc dx
cmp dx,80
jnz TUBEY
 
call display_image
 
pop si
mov ch,SCREEN*320/256
 
BLUR:
 
inc si
sar byte [si],2
loop BLUR
 
ret
 
 
 
display_image:
 
pusha
 
mov esi,PIXBUF
mov edi,0x10000
newp:
movzx edx,byte [esi]
shl edx,4
; mov dh,dl
mov [edi],edx
 
add edi,3
inc esi
 
cmp esi,320*160+PIXBUF
jbe newp
 
mov eax,7
mov ecx,320*65536+160
mov edx,10*65536+27
mov ebx,0x10000
int 0x40
 
popa
ret
 
 
 
draw_window:
 
pusha
 
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0
mov ebx,100*65536+339
mov ecx,100*65536+198
mov edx,0x03225588
mov esi,0x0
mov esi,0x0
int 0x40
 
mov eax,4
mov ebx,8*65536+8
mov ecx,0xffffff
mov edx,labeltext
mov esi,19
int 0x40
 
mov eax,12
mov ebx,2
int 0x40
 
popa
ret
 
labeltext db 'TUBE.ASM - with FPU'
 
db 41,0,0xC3,0x3C
 
TEXUV:
 
init_tube:
 
mov ecx,256
 
PAL1:
 
mov dx,3C8h
mov ax,cx
inc dx
sar al,1
js PAL2
mul al
shr ax,6
 
PAL2:
 
mov al,0
jns PAL3
sub al,cl
shr al,1
shr al,1
 
PAL3:
 
mov bx,cx
mov [ebx+0x1000],bh
loop PAL1
mov ecx,256
 
TEX:
 
mov bx,cx
add ax,cx
rol ax,cl
mov dh,al
sar dh,5
adc dl,dh
adc dl,[ebx+255+0x1000]
shr dl,1
mov [ebx+0x1000],dl
not bh
mov [ebx+0x1000],dl
loop TEX
 
fninit
fldz
 
ret
 
 
I_END:
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vrr/trunk/Warning.txt
0,0 → 1,7
 
Warning!
~~~~~~~~~~~~
 
This version requared of MeOS with supports driver model. Also for coorect work your system requared
video driver VMODE.MDR
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vrr/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm vrr.asm vrr
@pause
/programs/vrr/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm vrr.asm vrr
@pause
/programs/vrr/trunk/infoform.txt
0,0 → 1,25
Vertical Refresh Rate v.2.0
Information Card.
 
 
Monitor (Screen size, Vendor, trademark):
 
VideoCard (Vendor, trademark, Memory Size):
 
 
Mode 1280x1024 (Enable/Disable):
Enable refresh rate:
Notes:
 
Mode 1024x768 (Enable/Disable):
Enable refresh rate:
Notes:
 
Mode 800x600 (Enable/Disable):
Enable refresh rate:
Notes:
 
Mode 640x480 (Enable/Disable):
Enable refresh rate:
Notes:
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vrr/trunk/vrr.asm
0,0 → 1,1187
;
; Vertical Refresh Rate programm
;
; Author: Trans <<< 13 >>>
; Date: February-May 2003 (09.05.2003)
; Version: 2.0
; Last Modification: 30.07.2003
; 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 0x4ff0 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
include 'lang.inc'
START: ; start of execution
mov eax,14
int 40h
mov ebx,eax
shr ebx,16
mov [oldX],ebx
shl eax,16
shr eax,16
mov [oldY],eax
; Test on installed video driver
mov eax,21
mov ebx,13
mov ecx,1
mov edx,drvinfo
int 40h
cmp eax,0FFFFFFFFh ; = -1 - error or not installed
jne vrr_00
call warning_info
retn
;
vrr_00:
call get_vert_rate
mov eax,[currvm]
mov [oldvm],eax
call get_pid
call draw_window ; at first, draw the window
still:
mov eax,10 ; check 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
call get_pid
jmp still
red: ; redraw
call draw_window
jmp still
key: ; key
mov eax,2 ; just read it
int 0x40
cmp ah,'1'
jne key_loc_00
call safekey
jmp still
key_loc_00:
cmp ah,'2'
jne key_loc_01
call safekey
jmp still
key_loc_01:
cmp ah,'3'
jne key_loc_02
call safekey
jmp still
key_loc_02:
cmp ah,'4'
jne key_loc_03
call safekey
jmp still
key_loc_03:
cmp ah,'5'
jne key_loc_04
call safekey
jmp still
key_loc_04:
cmp ah,'-'
jne key_loc_05
xor eax,eax
call inc_dec_rate
jmp still
key_loc_05:
cmp ah,'+'
jne key_loc_06
xor eax,eax
inc eax
call inc_dec_rate
jmp still
key_loc_06:
cmp ah,'r' ;Return in last stable mode
jne key_loc_07
call restore_mode
jmp red
key_loc_07:
cmp ah,13 ;Apply select mode
jne still
xor eax,eax
mov ax,[vmselect]
cmp al,0
je still
xor ebx,ebx
mov bl,al
dec bl
shl bx,1 ; ebx=(ebx-1)*2
xor edx,edx
mov dx,[vidmode+ebx]
mov ecx,ebx
shl ebx,2
add ebx,ecx ; ebx=ebx*5
shr ax,8
dec ax
shl ax,1
add ebx,eax
ror edx,16
mov dx,[_m1+ebx]
rol edx,16
call set_my_mode
call protect_and_return
xor ax,ax
mov [vmselect],ax
jmp red
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 ;'+' screen width
jne button_loc_01
xor eax,eax
inc eax
call inc_dec_rate
jmp still
button_loc_01:
cmp ah,3 ;'-' screen width
jne button_loc_02
xor eax,eax
call inc_dec_rate
jmp still
button_loc_02:
cmp ah,4 ; Ok
jne button_loc_03
mov ah,13
jmp key_loc_07
button_loc_03:
cmp ah,5 ; Cancel
jne button_loc_04
mov [vmselect],word 00h
jmp red
button_loc_04:
cmp ah,6 ; Return
jne button_loc_05
mov ah,'r'
jmp key_loc_06
button_loc_05:
cmp ah,7 ; Default
jne button_loc_06
call restore_mode
button_loc_06:
jmp still
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
dw_continue:
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+400 ; [x start] *65536 + [x size]
mov ecx,100*65536+200 ; [y start] *65536 + [y size]
mov edx,0x020020C0;0x00000040 ; color of work area RRGGBB,8->color glide
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color glide
mov edi,0x00ffffff ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
call print_my_title
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(400-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x5599cc ; button color RRGGBB
int 0x40
; BUTTONS
xor eax,eax
mov edx,eax
mov al,8
mov ebx,330*65536+20
mov ecx,84*65536+48
mov dl,2
int 40h ; Button '+'Width
add ebx,30*65536
mov dl,3
int 40h ; Button '-'Width
mov ebx,22*65536+85
mov ecx,170*65536+15
inc dl ;dl=4
int 40h ; Button 'Ok'
add ebx,90*65536
inc dl ;dl=5
int 40h ; Button 'Cancel'
add ebx,90*65536
inc dl ;dl=6
int 40h ; Button 'Return'
add ebx,90*65536
inc dl ;dl=7
int 40h ; Button 'Default'
call draw_face
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
;------------Subfunctions-----------
restore_mode:
push eax
push ebx
push edx
call kill_all
mov eax,21
mov ebx,13
mov ecx,4
int 40h
call ref_screen
pop edx
pop ecx
pop eax
retn
; IN: edx = RefRate*65536+No.VideoMode
set_my_mode:
push ecx
push ebx
push edx
mov eax,[currvm]
mov [oldvm],eax
mov [currvm],edx
call kill_all
pop edx
push edx
mov eax,21
mov ebx,13
mov ecx,3
int 40h
pop edx
pop ebx
pop ecx
call ref_screen
retn
; IN: eax = 0/1 - -/+ 1Hz
inc_dec_rate:
push ebx
push ecx
push edx
mov edx,eax
mov eax,21
mov ebx,13
mov ecx,5
int 40h
pop edx
pop ecx
pop ebx
retn
ref_screen:
push eax
push ebx
push ecx
mov eax,5
mov ebx,100
int 40h
mov eax,19
mov ebx,strt
xor ecx,ecx
int 40h
pop ecx
pop ebx
pop eax
retn
get_pid:
mov eax,9
mov ebx,buffer
xor ecx,ecx
dec ecx
int 40h
mov [totp],eax
mov eax,[ebx+30]
mov [mypid],eax
mov ax,[ebx+4]
mov [mypno],ax
retn
get_vert_rate:
xor eax,eax
mov ebx,eax
mov ecx,eax
mov al,21
mov bl,13
mov cl,2
int 40h
mov [initrr],ebx
mov [refrate],ebx
ror ecx,16
mov cx,bx
rol ecx,16
mov [currvm],ecx
retn
kill_all:
call get_pid
mov ecx,[totp]
ka_loc_00:
push ecx
push ecx
mov eax,9
mov ebx,buffer
int 40h
pop ecx
mov eax,[mypid]
cmp eax,[ebx+30]
je ka_loc_02
mov eax,18
mov ebx,2
int 40h
ka_loc_02:
pop ecx
loop ka_loc_00
retn
get_initial_videomode:
retn
draw_table:
mov eax,13
mov ebx,9*65536+303
mov ecx,59*65536+87
xor edx,edx
int 40h
mov ebx,10*65536+300
mov ecx,60*65536+24
mov edx,00FF00FFh
int 40h
mov ebx,10*65536+36
mov ecx,72*65536+72
mov edx,0000FFFFh
int 40h
mov eax,38
mov edx,00FFFFFFh
mov ebx,10*65536+310
mov edi,60*65536+60
mov esi,12*65536+12
xor ecx,ecx
mov cl,8
dt_loc_hor_line:
push ecx
mov ecx,edi
int 40h
add edi,esi
pop ecx
loop dt_loc_hor_line
mov ebx,10*65536+10
mov edi,60*65536+144
mov esi,66*65536+66
mov ecx,edi
int 40h
add ebx,36*65536+36
xor ecx,ecx
mov cl,5
dt_loc_vert_line:
push ecx
mov ecx,edi
int 40h
add ebx,esi
pop ecx
loop dt_loc_vert_line
mov eax,4
mov ebx,52*65536+75
mov ecx,000000FFh
mov edx,_m1280x1024
mov esi,9
int 40h
add edx,9
add ebx,66*65536
int 40h
add edx,9
add ebx,66*65536
int 40h
add edx,9
add ebx,66*65536
int 40h
xor eax,eax
mov ebx,eax
mov ecx,eax
mov al,47
inc ebx
shl ebx,16
inc ecx
mov edi,ecx
mov edx,22*65536+86
mov esi,00FF0000h
mov ecx,5
dt_loc_00:
push ecx
mov ecx,edi
int 40h
inc edi
add dx,12
pop ecx
loop dt_loc_00
xor ecx,ecx
inc ecx
mov edi,ecx
mov edx,76*65536+63
mov esi,000000FFh
mov ecx,4
dt_loc_01:
push ecx
mov ecx,edi
int 40h
inc edi
add edx,66*65536
pop ecx
loop dt_loc_01
mov eax,4
mov ebx,16*65536+63
mov ecx,000000FFh
mov edx,_mk
mov esi,4
int 40h
shl ecx,16
add bx,12
add edx,4
int 40h
retn
;IN: ah=keycode
safekey:
sub ah,30h
push bx
mov bx,word [vmselect]
cmp bx,0
jnz sk_loc_00
cmp ah,5
je sk_loc_01
mov bl,ah
mov [vmselect],bx
jmp sk_loc_01
sk_loc_00:
push esi
push edx
push ecx
push eax
mov bh,ah
xor edx,edx
mov esi,_m1
mov al,bl
dec al
xor ah,ah
mov cx,10
mul cx
xor ecx,ecx
mov cx,ax
xor ax,ax
mov al,bh
dec al
shl ax,1
add cx,ax
add esi,ecx
lodsw
cmp ax,0
jnz sk_loc_02
xor eax,eax
mov bh,ah
sk_loc_02:
mov [vmselect],bx
pop eax
pop ecx
pop edx
pop esi
sk_loc_01:
call draw_window
pop bx
retn
; IN: ebx=Xstart*65536+Xend
; ecx=Ystart*65536+Yend
; edx=color
draw_rect:
push eax
push ebx
push ecx
push edx
push edi
xor eax,eax
mov al,38
push ecx
mov edi,ecx
shr edi,16
mov cx,di
int 40h
pop ecx
push ecx
mov edi,ecx
ror ecx,16
mov cx,di
int 40h
pop ecx
push ebx
mov edi,ebx
shr edi,16
mov bx,di
int 40h
pop ebx
mov edi,ebx
ror ebx,16
mov bx,di
int 40h
pop edi
pop edx
pop ecx
pop ebx
pop eax
retn
;
; OUT: eax = 0 - no event
protect_and_return:
push ebx
push ecx
xor eax,eax
mov al,5
xor ebx,ebx
mov bx,300
int 40h
call get_pid
xor eax,eax
mov ebx,eax
mov ecx,eax
mov al,18
mov ebx,3
mov cx,[mypno]
int 40h
pop ecx
pusha
call draw_window
popa
xor eax,eax
mov al,5
xor ebx,ebx
mov bx,300
int 40h
xor eax,eax
mov al,11
int 40h
cmp eax,1
jne par_loc_00
pusha
call draw_window
popa
par_loc_00:
xor eax,eax
mov ebx,eax
mov al,23
mov bx,700
int 40h
cmp eax,0
jnz par_loc_02
; mov [ftr_eax],eax
mov edx,[oldvm]
call set_my_mode
par_loc_02:
pop ebx
retn
debug_ftr:
; xor eax,eax
; mov ebx,eax
; mov al,47
; mov bl,8
; shl ebx,16
; mov bh,1
; mov ecx,[ftr_eax]
; mov edx,20*65536+180
; mov esi,00FFFFFFh
; int 40h
; mov ecx,[ftr_ebx]
; add edx,54*65536
; int 40h
retn
print_cur_vm:
mov eax,4
mov ebx,20*65536+40
mov ecx,0000FF00h
mov edx,curmode
mov esi,cmlen
int 40h
mov al,14
int 40h
mov esi,00FFFFFFh
mov edi,eax
shr eax,16
xor ecx,ecx
mov cx,ax
inc ecx
xor ebx,ebx
mov bl,4
shl ebx,16
mov edx,104*65536+40
mov eax,47
int 40h
add edx,30*65536
mov cx,di
inc ecx
int 40h
add edx,30*65536
mov ecx,[initrr]
sub ebx,1*65536
int 40h
mov al,4
mov ebx,200*65536+40
mov ecx,0000FF00h
mov edx,selmode
mov esi,cmlen
int 40h
mov ax,[vmselect]
cmp ax,0
jz pcv_loc_00
push eax
xor eax,eax
mov al,13
mov ebx,284*65536+54
mov ecx,40*65536+10
mov edx,000020C0h
int 40h
pop eax
push eax
xor ecx,ecx
dec al
mov cl,al
shl cx,3
add cl,al ; cx=(al-1)*9
mov edx,_m1280x1024
add edx,ecx
xor eax,eax
mov al,4
mov esi,9
mov ebx,284*65536+40
mov ecx,00ff0000h
int 40h
pop eax
cmp ah,0
jz pcv_loc_00
push esi
push edx
push ecx
push eax
xor eax,eax
mov al,13
mov ebx,344*65536+18
mov ecx,40*65536+10
mov edx,000020C0h
int 40h
pop eax
push eax
mov bx,ax
xor edx,edx
mov esi,_m1
mov al,bl
dec al
xor ah,ah
mov cx,10
mul cx
xor ecx,ecx
mov cx,ax
xor ax,ax
mov al,bh
dec al
shl ax,1
add cx,ax
add esi,ecx
lodsw
xor ecx,ecx
mov cx,ax
xor ebx,ebx
mov bl,3
shl ebx,16
mov edx,344*65536+40
xor eax,eax
mov al,47
mov esi,00ff0000h
int 40h
pop eax
pop ecx
pop edx
pop esi
pcv_loc_00:
retn
print_all_herz:
push esi
push edi
push eax
push ebx
push ecx
push edx
cld
mov esi,_m1
mov ebx,(10+36+26)*65536+86
mov edx,66*65536
xor ecx,ecx
mov cl,4
pah_loc_00:
push ecx
push edx
push ebx
mov cl,5
xor edx,edx
mov dl,12
pah_loc_01:
lodsw
cmp ax,00h
jnz pah_loc_02
call print_noherz
jmp pah_loc_03
pah_loc_02:
call print_herz
pah_loc_03:
add ebx,edx
loop pah_loc_01
pop ebx
pop edx
add ebx,edx
pop ecx
loop pah_loc_00
pop edx
pop ecx
pop ebx
pop eax
pop edi
pop esi
retn
; IN: ebx=X*65536+Y - coordinate
print_noherz:
push eax
push ebx
push ecx
push edx
push esi
xor eax,eax
mov al,4
mov ecx,00FFFFFFh
mov edx,noherz
xor esi,esi
mov si,3
int 40h
pop esi
pop edx
pop ecx
pop ebx
pop eax
retn
; IN: eax=numer_of_herz
; ebx=X*65536+Y
print_herz:
push eax
push ebx
push ecx
push edx
push esi
mov edx,ebx
xor ebx,ebx
mov bl,3
shl ebx,16
mov ecx,eax
mov esi,00FFFFFFh
xor eax,eax
mov al,47
int 40h
pop esi
pop edx
pop ecx
pop ebx
pop eax
retn
get_pixelclock:
retn
; light version of function
calc_refrate:
retn
rect_select:
mov ax,[vmselect]
; mov [ftr_ebx],eax
cmp ax,00h
je rs_loc_00
cmp ah,0
jne rs_loc_01
dec al
mov cx,66
mul cx
add ax,46
mov bx,ax
shl ebx,16
add ax,66
mov bx,ax
mov ecx,60*65536+144
mov edx,00ff0000h
call draw_rect
retn
rs_loc_01:
push ax
xor ah,ah
dec al
xor ebx,ebx
mov bx,66
mul bx
add ax,46
mov bx,ax
shl ebx,16
add ax,66
mov bx,ax
pop ax
xchg ah,al
xor ah,ah
dec al
xor ecx,ecx
mov cx,12
mul cx
add ax,84
mov cx,ax
shl ecx,16
add ax,12
mov cx,ax
mov edx,00ff0000h
call draw_rect
rs_loc_00:
retn
print_my_title:
pusha
xor eax,eax
mov ecx,eax
mov cl,labellen-labelt
mov al,4
mov edx,labelt
mov ebx,8*65536+8
mov edi,00ff0000h
xor esi,esi
inc esi
pmt_loc_00:
push ecx
mov ecx,edi
int 40h
inc edx
sub edi,4*65536
add edi,4*256
add ebx,6*65536
pop ecx
loop pmt_loc_00
popa
retn
draw_face:
call draw_table
;
;
mov ebx,320*65536+390
mov ecx,66*65536+144
mov edx,0000FF00h
call draw_rect
mov ebx,10*65536+390
mov ecx,27*65536+55
call draw_rect
add ebx,2*65536
sub bx,2
add ecx,2*65536
sub cx,2
call draw_rect
mov ebx,10*65536+390
mov ecx,155*65536+193
call draw_rect
add ebx,2*65536
sub bx,2
add ecx,2*65536
sub cx,2
call draw_rect
xor eax,eax
mov al,13
mov ebx,182*65536+36
mov ecx,26*65536+5
mov edx,000020C0h
int 40h
mov ebx,173*65536+54
mov ecx,153*65536+7
int 40h
mov ebx,337*65536+36
mov ecx,62*65536+10
int 40h
mov al,4
shr ecx,16
mov bx,cx
add ebx,3*65536
mov ecx,00FF0000h
mov edx,width
mov esi,5
int 40h
xor ecx,ecx
add edx,5
xor esi,esi
inc esi
mov ebx,335*65536+104
int 40h
add ebx,36*65536
inc edx
int 40h
mov edx,tmode
mov ecx,00FF0000h
mov ebx,182*65536+24
mov esi,6
int 40h
mov edx,actions
mov ebx,173*65536+152
mov esi,9
int 40h
xor ecx,ecx
mov edx,button1
mov ebx,59*65536+174
mov esi,2
int 40h
add edx,esi
mov esi,6
add ebx,78*65536
int 40h
add edx,esi
add ebx,90*65536
int 40h
add edx,esi
mov esi,7
add ebx,87*65536
int 40h
call rect_select
; call debug_ftr
call print_cur_vm
call print_all_herz
retn
warning_info:
call warning_window
call warning_loop
retn
warning_window:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WARNING WINDOW
mov eax,0 ; function 0 : define and draw window
; mov ebx,100*65536+400 ; [x start] *65536 + [x size]
mov ebx,[oldX]
shr ebx,1
sub ebx,200
shl ebx,16
mov bx,400
; mov ecx,100*65536+200 ; [y start] *65536 + [y size]
mov ecx,[oldY]
shr ecx,1
sub ecx,100
shl ecx,16
mov cx,200
mov edx,0x02808080 ; color of work area RRGGBB,8->color glide
mov esi,0x40300010 ; color of grab bar RRGGBB,8->color glide
mov edi,0x00ff0000 ; color of frames RRGGBB
int 0x40
; WARNING WINDOW LABEL
call print_my_title
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(200-36)*65536+72 ; [x start] *65536 + [x size]
mov ecx,(160-9)*65536+18 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x00800010 ; button color RRGGBB
int 0x40
; WARNING TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,(200-(len_warn00/2)*6)*65536+60 ; [x start] *65536 + [y
;]
mov ecx,0xf0ff0000 ; color of text RRGGBB
mov edx,warn00 ; pointer to text beginning
mov esi,len_warn00 ; text length
; int 0x40
; inc ebx
int 40h
add ebx,1*65536
int 40h
mov ebx,(200-(len_warn01/2)*6)*65536+100
mov edx,warn01
mov esi,len_warn01
int 40h
mov edx,button1
add ecx,0ffffh
mov ebx,(200-6)*65536+(160-4)
mov esi,2
int 40h
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
retn
warning_loop:
mov eax,5
mov ebx,13
int 0x40
mov eax,11
int 40h
cmp eax,1 ; redraw request ?
je warning_red
cmp eax,2 ; key in buffer ?
je warning_key
cmp eax,3 ; button in buffer ?
je warning_button
mov eax,4
mov ebx,(200-(len_warn01/2)*6)*65536+100
mov ecx,[blinkcol]
sub cl,12
dec cl
dec cl
dec cl
dec cl
mov [blinkcol],ecx
mov ch,0f0h
shl ecx,16
mov edx,warn01
mov esi,len_warn01
int 40h
sub ebx,1*65536
int 40h
jmp warning_loop
warning_red: ; redraw
call warning_window
jmp warning_loop
warning_key: ; key
mov eax,2 ; read key
int 0x40
cmp ah,01h
jne warning_loop
xor eax,eax
dec eax ; Terminate application
int 40h
jmp warning_loop
warning_button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne warning_loop
xor eax,eax
dec eax ; close this program
int 0x40
jmp warning_loop
retn
;------------DATA AREA---------------
oldX dd ?
oldY dd ?
initvm dd ?
currvm dd 0
oldvm dd 0
refrate dd 0
initrr dd 0
mypid dd ?
mypno dw ?
totp dd ?
vmselect dw 0
ftr_eax dd ?
ftr_ebx dd ?
blinkcol dd 0ffh
; db 0,0,0,0,0,0,0,0
;_m1 dw 0,0,0,0,0
;_m2 dw 0,0,0,0,0
;_m3 dw 0,0,0,0,0
;_m4 dw 0,0,0,0,0
labelt:
db 'Vertical Refresh Rate, ver.2.0, Copileft 2003 ;) TRANS'
labellen:
_m1280x1024 db '1280x1024'
_m1024x768 db '1024x768 '
_m800x600 db ' 800x600 '
_m640x480 db ' 640x480 '
_mk db 'Key1Key2'
curmode db 'Current mode: '
db ' x x Hz'
cmlen=$-curmode
selmode db ' Select mode: '
selcans db '----x----x---Hz'
noherz db '---'
width db 'Width',11h,10h
tmode db ' Mode '
actions db ' Actions '
button1 db 'Ok' ;len=2
button2 db 'Cancel' ;len=6
button3 db 'Return' ;len=6
button4 db 'Default' ;len=7
strt db 'LAUNCHER '
warn00 db ' W A R N I N G ! '
len_warn00=$-warn00
warn01 db 'V i d e o D r i v e r N O T I n s t a l l e d'
len_warn01=$-warn01
drvinfo: ; 512 bytes driver info area
; +0 - Full driver name
; +32 - Driver version
; +64 - Word List of support video modes (max 32 positions)
; +128 - 5 words list of support vertical rate to each present mode
org $+32
drvver:
org $+32
vidmode:
org $+64
_m1:
org drvinfo+200h
buffer:
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vrr/trunk/vrr_eng.txt
0,0 → 1,104
Vertical Refresh Rater
 
Version 2.0
 
Copyright (C) 2003, Trans
 
 
Text Version 1.1 (02.08.03)
 
Win text (cp1251). (DOS codepage text - see down.)
-------------------------------------------------------------------------------
 
Contents:
1. Why it need?
2. Installation.
3. Using.
4. FAQ.
5. Support.
 
1. Why it need?
---------------------
The problem of "60 Hz" is falling stand before of users of MeOS in modern condisions.
As a rule, most modern computers consist of 17" monitor (all written later is not actual
for owners of LCD monitors). If on 14" or 15" monitors the problem of "60 Hz" not a
main, but with 17" monitor it's a most pantfull. And with more size monitors I have no
words for discusion: it's a slade-show. Of couse, all of the upper correlated with
standart interface of VESA. As for VESA 3.0 - yes, interface have more rich features,
but it have no possiblity of change videomode in protect mode (the Virtual86 not realized
in MeOS !!!!!).
 
The MeOS not known as a detected devices on boot, it setting of standard VESA videomode
with 60 Hz vertical refrash rate !
 
This programm is a FreeWare. And distribute "AS IS ...". Author not
carreing responsibility for probable damage :) .
 
!!!!!_Warning_!!!!!:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! On this time programm have a EXPERIMENTAL status (!). And this reason you have a !
! chance destroy own device (monitor). Espesialy this taking attantionall users with !
! monitor without of rate protection. !
! If you decide using this util I have a suggestion: fill of information form and !
! send me. !
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
2. Installation.
-----------------
Extract file VRR (it's ordinary executed MeOS file) from archive and situated it on
C:\ root or MeOS floppy. In main, VRR may situated on any directory (you must have
possibility run this file under MeOS).
 
 
3. Using.
----------
The VRR is a standard executed file of Menuet Operation System. You may send on
execute this file by SYSTREE or MASH.
 
After redraw of programm window will be present of current vertical refrash rate
and table with possibiling videoregimes. It's sorrably, table have VERY small
videomode (the programm is experimental).
 
Change of videomode
~~~~~~~~~~~~~~~~~~~~~
You may select interesting videomode using _ONLY_ numerical keys: 1,2,3,4 and 5.
In a first step you must select resolution of videoregime. In a second step - need
select of vertical refresh rate. All changes are indicated on screen in a the
programm window. After select videomode, to set mode you must press "Enter" or
button "Ok". Notification: in this time all executing MeOS programs will be
killing. It this needed for minimize artefacts of the screen. After change videomode
you have a two way. First way: you can not any doing and after 13 seconds waiting
return last videomode. Second way: press two-three time any key or some time mouse
click on artefacts of VRR (or this plase) and fixing selected mode. Also you have
possibility modification of horizontal screen size by button "Left"\"Right" or keys
"+\-". For correcting your select you may use button "Cancel".
 
Also in programm realized return at initial videomode with 60 Hz vertical refresh
by button "Default". And you may return in last videomode by button "Return" or
key "r"
 
Note:
~~~~~~
In this time programm may change vertical refresh rate _ONLY_ by lowing screen
resolution, because this method will be using at most part videocard
(VGA, SVGA or modern)
 
Example:
If you have videomode 1024x768x60Hz and if you want select 800x600x95Hz, you must
press key "3" and key "1". After that key "Enter" or button "Ok". And after redraw
screen two time click on last program window position. If need using button
"Left\Right" for correcting horizontal size.
 
4. FAQ.
----------
 
5. Supports.
----------------
All questions, notes and wishs you may send to author by following e-mail:
 
transafe@rambler.ru
transafe@chat.ru
trans397@yahoo.com
 
Using with enjoy!
Trans.
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vrr/trunk/vrr_rus.txt
0,0 → 1,218
Vertical Refresh Rater
 
Âåðñèÿ 2.0
 
Copyright (C) 2003, Trans
 
 
Text Version 1.1 (02.08.03)
 
Win text (cp1251). (DOS codepage text - see down.)
-------------------------------------------------------------------------------
 
Ñîäåðæàíèå:
1. Çà÷åì ýòî íàäî?
2. Óñòàíîâêà.
3. Èñïîëüçîâàíèå.
4. Âîïðîñû è îòâåòû.
5. Ïîääåðæêà.
 
1. Çà÷åì ýòî íàäî?
---------------------
Ïðîáëåìà "60 Ãö" î÷åíü îñòðî âñòàåò ïåðåä ïîëüçîâàòåëÿìè MeOS â ñîâðåìåííûõ óñëîâèÿõ.
Êàê ïðàâèëî, áîëüøèíñòâî ñîâðåìåííûõ êîìïüòåðîâ êîìïëåêòóåòñÿ 17 äþéìîâûìè
ìîíèòîðàìè (âñå ÷òî íàïèñàíî íèæå êðàéíå íå àêòóàëüíî äëÿ âëàäåëüöåâ ÆÊ ìîíèòîðîâ).
Åñëè íà 14 èëè 15 äþéìîâîì ìîíèòîðå åùå ìîæíî êàê òî ñìðèòüñÿ ñ ÷àñòîòîé âåðòèêàëüíîé
ðàçâåðòêè 60 Ãö, òî óæå ïðè 17 äþéìîâîì ìîíèòîðå ýòî ïðåâðàùàåòñÿ â ïûòêó. À ïðî
áîëüøèõ ðàçìåðîâ ìîíèòîðû âîîáùå ãîâîðèòü íå õî÷åòñÿ, ò.ê. ýòî ïðåâðàùàåòñÿ ïî÷òè
â ñëàéä-øîó. Êîíå÷íî æå âñå âûøå ñêàçàííîå îòíîñèòñÿ ê ñòàíäàðòíîìó èíòåðôåéñó
VESA. Ñðàçó õî÷ó ïðåäóïðåäèòü âîïðîñû ïî ïîâîäó VESA 3.0 - äà, èíòåðôåéñ áîëåå
áîãàòûé ïî âîçìîæíîñòÿì, íî è â íåì íåò ñïîñîáà ïðåêëþ÷åíèÿ âèäåîðåæèìà ïðè
ðàáîòå ïðîöåññîðà â çàùèùåííîì ðåæèìå (ðåæèì V86 â MeOS íå ðåàëèçîâàí !!!).
 
 ñâÿçè ñ òåì, ÷òî MeOS íå óìååò (åùå íå íàó÷èëè :) ) äåòåêòèðîâàòü îáîðóäîâàíèå
êîìïüþòåðà ïðè çàãðóçêå, óñòàíàâëèâàåìûé ãðàôè÷åñêèé âèäåîðåæèì èìååò ñòàíäàðòíóþ
÷àñòîòó âåðòèêàëüíîé ðàçâåðòêè ðàâíóþ 60 Ãö (!!!!!)
Ïðîãðàììà ÿâëÿåòñÿ ñâîáîäíî ðàñïðîñòðàíÿåìîé (FreeWare) è ïîñòàâëÿåòñÿ "Êàê åñòü...".
Àâòîð íå íåñåò îòâåòñòâåííîñòè çà âîçìîæíûé ïðè÷èíåííûé óùåðá ( :) ).
 
!!!!!_Ïðåäóïðåæäåíèå_!!!!!:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Íà òåêóùèé ìîìåíò ïðîãðàììà íîñèò ÝÊÑÏÅÐÈÌÅÍÒÀËÜÍÛÉ (!) õàðàêòåð, ïîýòîìó âñåãäà !
! îñòàåòñÿ âåðîÿòíîñòü ïîð÷è îáîðóäîâàíèÿ (ò.å. ìîíèòîðà). Îñîáåííî ýòî êàñàåòñÿ âñåõ !
! òåõ, ÷åé ìîíèòîð íå èìååò çàùèòû îò ïåðåãðóçîê ïî ÷àñòîòå. !
! Äëÿ âñåõ ðèñêíóâøèõ - ïðîñüáà -> Çàïîëíèòü ïðèëàãàþùóþñÿ èíôîðìàöèîííóþ ôîðìó !
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
2. Óñòàíîâêà.
---------------
Èçâëå÷ü ôàéë VRR (èñïîëíÿåìûé ôàéë MeOS) èç àðõèâà è ïîìåñòèòü â êîðíåâîé êàòàëîã
äèñêà C:\ (Fat32.  ïðèíöèïå, ìîæåò áûòü ëþáîé êàòîëîã) èëè íà çàãðóçî÷íóþ äèñêåòó
MeOS.
 
 
3. Èñïîëüçîâàíèå.
--------------------
Ôàéë VRR ÿâëÿåòñÿ ñòàíäàðíûì èñïîëíÿåìûì ôàéëîì îïåðàöèîííîé ñèñòåìû MeOS, êîòîðûé
ìîæíî çàïóñòèòü íà èñïîëíåíèå, íàïðèìåð, ÷åðåç SYSTREE èëè MASH.
 
Ïîñëå ïîÿâëåíèÿ îêíà ïðîãðàììû, áóäåò îòîáðàæåíî òåêóùåå ðàçðåøåíèå è òàáëèöà
âîçìîæíûõ ðåæèìîâ è ÷àñòîò âåðòèêàëüíîé ðàçâåðòêè äëÿ íèõ. Ê ñîæàëåíèþ, ðàçâåðòîê
ïîêà î÷åíü ìàëî (ïîõîæå íà òî, ýòî î÷åíü êðóòîé ñåêðåò èëè æå ýòèì íèêòî â ñåðüåç
íå çàíèìàëñÿ ââèäó îòïóãèâàþùåé ñëîæíîñòè. Âî âñÿêîì ñëó÷àå â ñåòè êðàéíå ìàëî
èíôîðìàöèè ïî ýòîìó ïîâîäó è ïî áîëüøåé ÷àñòè ïðèõîäèòñÿ äîãàäûâàòüñÿ î ïîëîæåíèè
äåë).
 
Âûáîð è óñòàíîâêà âèäîðåæèìà
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Âèäîåðåæèì ñ èíòåðåñóþùåé ÷àñòîòîé ìîæíî âûáðàòü _òîëüêî_ (!!!!!) ñ ïîìîùüþ
öèôðîâûõ êëàâèø: 1, 2, 3, 4, 5. Ñíà÷àëî íóæíî âûáðàòü ðàçðåøåíèå, à çàòåì
÷àñòîòó. Êàæäûé âûáîð ñîïðîâîæäàåòñÿ èíäèêàöèåé íà ýêðàíå. Äëÿ óñòàíîâëåíèÿ
âûáðàííîãî âèäåîðåæèìà íóæíî íàæàòü êëàâèøó 'Enter' èëè êíîïêó 'Ok'. Ïîñëå ïåðåõîäà
â âûáðàííûé âèäåîðåæèì ó âàñ åñòü 13 ñåêóíä âûáîðà. Ìîæíî íè÷åãî íå äåëàòü è
÷åðåç ýòî âðåìÿ âåðíåòåñü â èñõîäíûé âèäåîðåæèì, à ìîæíî íàæàòü ïàðó ðàç êàêóþ-
-íèáóäü êëàâèøó èëè êëèêíóòü ïàðó ðàç ïî "îñòàòêàì" (àðòåôàêòàì) èñõîäíîãî îêíà
ïðîãðàììû è çàôèêñèðîâàòü âûáîð. Ðàçìåðû îêíà ïî ãîðèçîòàëè ìîæíî ðåãóëèðîâàòü
êíîïêàìè "Ïðàâî\Ëåâî" èëè êëàâèøàìè "+\-".
Äëÿ êîððåêòèðîâêè âûáîðà èñïîëüçóéòå êíîïêó "Cancel".
 
 ïðîãðàììå ðåàëèçîâàíî ïðèíóäèòåëüíîå âîçâðàùåíèå â èñõîäíûé âèäåîðåæèì ñ ÷àñòîòîé
60 Ãö ñ ïîìîùüþ êíîïêè "Default". À òàê æå ìîæåòå âåðíóòüñÿ â ïîñëåäíèé ðàáî÷èé
ðåæèì ñ ïîìîùüþ êíîïêè "Return" èëè êëàâèøè 'r'.
 
Ïðèìåð:
Óñòàíîâëåí ðåæèì 1024õ768 ïðè 60 Ãö. Íóæíî 800õ600 ïðè 95 Ãö.
Äåéñòâèÿ: íàæàòü '3', çàòåì '1' è äàëåå êëàâèøó "Enter" èëè êíîïêó "Ok". Ïîñëå ïåðåõîäà
â âûáðàííûé âèäåîðåæèì êëèêàåì ïàðó ðàç íà "îñòàòêà" (èëè òîì ìåñòå ãäå áûëî) îêíà.
Äàëåå ïðè íåîáõîäèìîñòè êîððåêòèðóåì ðàçìåð ýêðàíà ïî ãîðèçîíòàëè ñ ïîìîùüþ êíîïîê
"Ïðàâî\Ëåâî"
 
 
4. Âîïðîñû è îòâåòû.
------------------------
 
5. Ïîääåðæêà.
----------------
Âñå âîïðîñû, çàìå÷àíèÿ è ïîæåëàíèÿ Âû ìîæåòå íàïðàâèòü àâòîðó ïî ñëåäóþùèì àäðåñàì:
 
transafe@rambler.ru
transafe@chat.ru
trans397@yahoo.com
 
Ïîëüçóéòåñü íà çäîðîâüå!
Trans.
 
 
 
 
 
DOS codepage text:
_______________________________________________________________________________
 
Vertical Refresh Rater
 
‚¥àá¨ï 2.0
 
Copyright (C) 2003, Trans
 
 
Text Version 1.1 (02.08.03)
 
Win text (cp1251). (DOS codepage text - see down.)
-------------------------------------------------------------------------------
 
‘®¤¥à¦ ­¨¥:
1. ‡ ç¥¬ íâ® ­ ¤®?
2. “áâ ­®¢ª .
3. ˆá¯®«ì§®¢ ­¨¥.
4. ‚®¯à®áë ¨ ®â¢¥âë.
5. ®¤¤¥à¦ª .
 
1. ‡ ç¥¬ íâ® ­ ¤®?
---------------------
à®¡«¥¬  "60 ƒæ" ®ç¥­ì ®áâà® ¢á⠥⠯¥à¥¤ ¯®«ì§®¢ â¥«ï¬¨ MeOS ¢ ᮢ६¥­­ëå
ãá«®¢¨ïå. Š ª ¯à ¢¨«®, ¡®«ì設á⢮ ᮢ६¥­­ëå ª®¬¯ìâ¥à®¢ ª®¬¯«¥ªâã¥âáï 17
¤î©¬®¢ë¬¨ ¬®­¨â®à ¬¨ (¢á¥ çâ® ­ ¯¨á ­® ­¨¦¥ ªà ©­¥ ­¥  ªâã «ì­® ¤«ï ¢« ¤¥«ì楢
†Š ¬®­¨â®à®¢). …᫨ ­  14 ¨«¨ 15 ¤î©¬®¢®¬ ¬®­¨â®à¥ ¥é¥ ¬®¦­® ª ª â® á¬à¨âìáï á
ç áâ®â®© ¢¥à⨪ «ì­®© à §¢¥à⪨ 60 ƒæ, ⮠㦥 ¯à¨ 17 ¤î©¬®¢®¬ ¬®­¨â®à¥ íâ®
¯à¥¢à é ¥âáï ¢ ¯ëâªã. € ¯à® ¡®«ìè¨å à §¬¥à®¢ ¬®­¨â®àë ¢®®¡é¥ £®¢®à¨âì ­¥
å®ç¥âáï, â.ª. íâ® ¯à¥¢à é ¥âáï ¯®ç⨠¢ á« ©¤-è®ã. Š®­¥ç­® ¦¥ ¢á¥ ¢ëè¥ áª § ­­®¥
®â­®á¨âáï ª áâ ­¤ àâ­®¬ã ¨­â¥à䥩áã VESA. ‘à §ã å®ç㠯।ã¯à¥¤¨âì ¢®¯à®áë ¯®
¯®¢®¤ã VESA 3.0 - ¤ , ¨­â¥àä¥©á ¡®«¥¥ ¡®£ âë© ¯® ¢®§¬®¦­®áâï¬, ­® ¨ ¢ ­¥¬ ­¥â
ᯮᮡ  ¯à¥ª«î祭¨ï ¢¨¤¥®à¥¦¨¬  ¯à¨ à ¡®â¥ ¯à®æ¥áá®à  ¢ § é¨é¥­­®¬ ०¨¬¥
(०¨¬ V86 ¢ MeOS ­¥ ॠ«¨§®¢ ­ !!!).
 
‚ á¢ï§¨ á ⥬, çâ® MeOS ­¥ 㬥¥â (¥é¥ ­¥ ­ ã稫¨ :) ) ¤¥â¥ªâ¨à®¢ âì ®¡®à㤮¢ ­¨¥
ª®¬¯ìîâ¥à  ¯à¨ § £à㧪¥, ãáâ ­ ¢«¨¢ ¥¬ë© £à ä¨ç¥áª¨© ¢¨¤¥®à¥¦¨¬ ¨¬¥¥â
áâ ­¤ àâ­ãî ç áâ®âã ¢¥à⨪ «ì­®© à §¢¥à⪨ à ¢­ãî 60 ƒæ (!!!!!)
à®£à ¬¬  ï¥âáï ᢮¡®¤­® à á¯à®áâ࠭塞®© (FreeWare) ¨ ¯®áâ ¢«ï¥âáï
"Š ª ¥áâì...". €¢â®à ­¥ ­¥á¥â ®â¢¥âá⢥­­®á⨠§  ¢®§¬®¦­ë© ¯à¨ç¨­¥­­ë©
ãé¥à¡ ( :) ).
 
!!!!!_à¥¤ã¯à¥¦¤¥­¨¥_!!!!!:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!   ⥪ã騩 ¬®¬¥­â ¯à®£à ¬¬  ­®á¨â Š‘…ˆŒ…’€‹œ›‰ (!) å à ªâ¥à, ¯®í⮬ã !
! ¢á¥£¤  ®áâ ¥âáï ¢¥à®ïâ­®áâì ¯®àç¨ ®¡®à㤮¢ ­¨ï (â.¥. ¬®­¨â®à ). Žá®¡¥­­® íâ®!
! ª á ¥âáï ¢á¥å â¥å, 祩 ¬®­¨â®à ­¥ ¨¬¥¥â § é¨âë ®â ¯¥à¥£à㧮ª ¯® ç áâ®â¥. !
! „«ï ¢á¥å à¨áª­ã¢è¨å - ¯à®áì¡  -> ‡ ¯®«­¨âì ¯à¨« £ îéãîáï ¨­ä®à¬ æ¨®­­ãî ä®à¬ã! !
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
2. “áâ ­®¢ª .
---------------
ˆ§¢«¥çì ä ©« VRR (¨á¯®«­ï¥¬ë© ä ©« MeOS) ¨§  à娢  ¨ ¯®¬¥áâ¨âì ¢ ª®à­¥¢®©
ª â «®£ ¤¨áª  C:\ (Fat32. ‚ ¯à¨­æ¨¯¥, ¬®¦¥â ¡ëâì «î¡®© ª â®«®£) ¨«¨ ­ 
§ £à㧮ç­ãî ¤¨áª¥âã MeOS.
 
 
3. ˆá¯®«ì§®¢ ­¨¥.
--------------------
” ©« VRR ï¥âáï áâ ­¤ à­ë¬ ¨á¯®«­ï¥¬ë¬ ä ©«®¬ ®¯¥à æ¨®­­®© á¨á⥬ë MeOS,
ª®â®àë© ¬®¦­® § ¯ãáâ¨âì ­  ¨á¯®«­¥­¨¥, ­ ¯à¨¬¥à, ç¥à¥§ SYSTREE ¨«¨ MASH.
 
®á«¥ ¯®ï¢«¥­¨ï ®ª­  ¯à®£à ¬¬ë, ¡ã¤¥â ®â®¡à ¦¥­® ⥪ã饥 à §à¥è¥­¨¥ ¨ â ¡«¨æ 
¢®§¬®¦­ëå ०¨¬®¢ ¨ ç áâ®â ¢¥à⨪ «ì­®© à §¢¥à⪨ ¤«ï ­¨å. Š ᮦ «¥­¨î,
à §¢¥à⮪ ¯®ª  ®ç¥­ì ¬ «® (¯®å®¦¥ ­  â®, íâ® ®ç¥­ì ªàã⮩ ᥪà¥â ¨«¨ ¦¥ í⨬
­¨ªâ® ¢ á¥à쥧 ­¥ § ­¨¬ «áï ¢¢¨¤ã ®â¯ã£¨¢ î饩 á«®¦­®áâ¨. ‚® ¢á类¬ á«ãç ¥ ¢
á¥â¨ ªà ©­¥ ¬ «® ¨­ä®à¬ æ¨¨ ¯® í⮬㠯®¢®¤ã ¨ ¯® ¡®«ì襩 ç á⨠¯à¨å®¤¨âáï
¤®£ ¤ë¢ âìáï ® ¯®«®¦¥­¨¨ ¤¥«).
 
‚ë¡®à ¨ ãáâ ­®¢ª  ¢¨¤®à¥¦¨¬ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
‚¨¤®¥à¥¦¨¬ á ¨­â¥à¥áãî饩 ç áâ®â®© ¬®¦­® ¢ë¡à âì _⮫쪮_ (!!!!!) á ¯®¬®éìî
æ¨ä஢ëå ª« ¢¨è: 1, 2, 3, 4, 5. ‘­ ç «® ­ã¦­® ¢ë¡à âì à §à¥è¥­¨¥,   § â¥¬
ç áâ®âã. Š ¦¤ë© ¢ë¡®à ᮯ஢®¦¤ ¥âáï ¨­¤¨ª æ¨¥© ­  íªà ­¥. „«ï ãáâ ­®¢«¥­¨ï
¢ë¡à ­­®£® ¢¨¤¥®à¥¦¨¬  ­ã¦­® ­ ¦ âì ª« ¢¨èã 'Enter' ¨«¨ ª­®¯ªã 'Ok'. ®á«¥
¯¥à¥å®¤  ¢ ¢ë¡à ­­ë© ¢¨¤¥®à¥¦¨¬ ã ¢ á ¥áâì 13 ᥪ㭤 ¢ë¡®à . Œ®¦­® ­¨ç¥£® ­¥
¤¥« âì ¨ ç¥à¥§ íâ® ¢à¥¬ï ¢¥à­¥â¥áì ¢ ¨á室­ë© ¢¨¤¥®à¥¦¨¬,   ¬®¦­® ­ ¦ âì ¯ àã
à § ª ªãî-­¨¡ã¤ì ª« ¢¨èã ¨«¨ ª«¨ª­ãâì ¯ àã à § ¯® "®áâ âª ¬" ( àâ¥ä ªâ ¬)
¨á室­®£® ®ª­  ¯à®£à ¬¬ë ¨ § ä¨ªá¨à®¢ âì ¢ë¡®à.  §¬¥àë ®ª­  ¯® £®à¨§®â «¨
¬®¦­® ॣ㫨஢ âì ª­®¯ª ¬¨ "à ¢®\‹¥¢®" ¨«¨ ª« ¢¨è ¬¨ "+\-".
„«ï ª®à४â¨à®¢ª¨ ¢ë¡®à  ¨á¯®«ì§ã©â¥ ª­®¯ªã "Cancel".
 
‚ ¯à®£à ¬¬¥ ॠ«¨§®¢ ­® ¯à¨­ã¤¨â¥«ì­®¥ ¢®§¢à é¥­¨¥ ¢ ¨á室­ë© ¢¨¤¥®à¥¦¨¬ á
ç áâ®â®© 60 ƒæ á ¯®¬®éìî ª­®¯ª¨ "Default". € â ª ¦¥ ¬®¦¥â¥ ¢¥à­ãâìáï ¢
¯®á«¥¤­¨© à ¡®ç¨© ०¨¬ á ¯®¬®éìî ª­®¯ª¨ "Return" ¨«¨ ª« ¢¨è¨ 'r'.
 
à¨¬¥à:
“áâ ­®¢«¥­ ०¨¬ 1024å768 ¯à¨ 60 ƒæ. ã¦­® 800å600 ¯à¨ 95 ƒæ.
„¥©á⢨ï: ­ ¦ âì '3', § â¥¬ '1' ¨ ¤ «¥¥ ª« ¢¨èã "Enter" ¨«¨ ª­®¯ªã "Ok".
®á«¥ ¯¥à¥å®¤  ¢ ¢ë¡à ­­ë© ¢¨¤¥®à¥¦¨¬ ª«¨ª ¥¬ ¯ àã à § ­  "®áâ âª " (¨«¨ ⮬
¬¥á⥠£¤¥ ¡ë«®) ®ª­ . „ «¥¥ ¯à¨ ­¥®¡å®¤¨¬®á⨠ª®à४â¨à㥬 à §¬¥à íªà ­  ¯®
£®à¨§®­â «¨ á ¯®¬®éìî ª­®¯®ª "à ¢®\‹¥¢®"
 
 
4. ‚®¯à®áë ¨ ®â¢¥âë.
------------------------
 
5. ®¤¤¥à¦ª .
----------------
‚ᥠ¢®¯à®áë, § ¬¥ç ­¨ï ¨ ¯®¦¥« ­¨ï ‚ë ¬®¦¥â¥ ­ ¯à ¢¨âì  ¢â®àã ¯® á«¥¤ãî騬  ¤à¥á ¬:
 
transafe@rambler.ru
transafe@chat.ru
trans397@yahoo.com
 
®«ì§ã©â¥áì ­  §¤®à®¢ì¥!
Trans.
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vrr_m/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm vrr_m.asm vrr_m
@pause
/programs/vrr_m/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm vrr_m.asm vrr_m
@pause
/programs/vrr_m/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vrr_m/trunk/vrr_m.asm
0,0 → 1,108
;
; à¨¬¥à ¯à®£à ¬¬ë ¤«ï 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:
; mcall 5,10
mcall 21,13,1,drvinfo
; jmp run_launcher
 
mcall 21,13,2
cmp eax,-1
je run_launcher
; cmp ecx,280
; je change_vrr
; cmp ecx,277
; je change_vrr
; cmp ecx,6
; je change_vrr
; cmp ecx,7
; je change_vrr
; jmp run_launcher
change_vrr:
; mov ax,cx
; dec cx
; shl cx,1
; xor edx,edx
; mov dx,[vidmode+ecx]
; mov ebx,ecx
; shl ebx,2
; add ebx,ecx ; ebx=ebx*5
; shr ax,8
; dec ax
; shl ax,1
; add ebx,eax
; ror edx,16
; mov dx,[_m1+ebx]
; rol edx,16
;mov eax,ecx
xor eax,eax
sub ecx,3
mov dx,cx
cmp cx,274
je yes_274
cmp cx,277
je yes_277
jmp yes_280
yes_274:
add al,10
yes_277:
add al,10
yes_280:
add al,10
ror edx,16
mov dx,[_m1+eax]
rol edx,16
; mov dx,bx
; shl edx,16
; mov dx,cx
mcall 21,13,3
; mcall 5,300
run_launcher:
mcall 19,launcher,0
; mcall 33,text,drvinfo,512,0
mcall -1
launcher db 'LAUNCHER '
;text db 'TEXT '
drvinfo: ; 512 bytes driver info area
; +0 - Full driver name
; +32 - Driver version
; +64 - Word List of support video modes (max 32 positions)
; +128 - 5 words list of support vertical rate to each present mode
org $+32
drvver:
org $+32
vidmode:
org $+64
_m1:
org drvinfo+200h
 
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vscreen/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm vscreen.asm vscreen
@pause
/programs/vscreen/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm vscreen.asm vscreen
@pause
/programs/vscreen/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/vscreen/trunk/vscreen.asm
0,0 → 1,417
;
; VIRTUAL SCREEN 2
; based on the original VSCREEN
;
; Compile with FASM for Menuet
;'
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x600000 ; required amount of memory
dd 0xfff0
dd 0,0
 
scr equ 0x20000
 
include 'lang.inc'
include 'macros.inc'
 
START: ; start of execution
 
mov eax,14 ; get screen size
int 0x40
push eax
and eax,0x0000ffff
inc eax
mov [size_y],eax
pop eax
shr eax,16
inc eax
mov [size_x],eax
 
mov eax,[size_x]
shr eax,2
mov [cmp_ecx],eax
 
mov eax,[size_x]
xor edx,edx
mov ebx,3
mul ebx
mov [add_esi],eax
 
mov eax,[size_y]
shr eax,2
mov [cmp_edx],eax
 
mov eax,[size_y]
imul eax,[size_x]
imul eax,3
mov [i_size],eax
 
red:
call draw_window ; at first, draw the window
 
still:
 
call draw_screen
 
mov eax,23 ; wait here for event with timeout
mov ebx,[delay]
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
mov eax,2
int 0x40 ; just read it and ignore
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jnz noclose
exit:
or eax,-1 ; close this program
int 0x40
noclose:
 
cmp ah,2
jnz still
 
mov eax,51
xor ebx,ebx
inc ebx
mov ecx,thread_start
mov edx,0xe000
int 0x40
 
jmp exit
 
thread_start:
mov eax,5 ; wait for termination (1 sec.)
mov ebx,100
int 0x40
 
call save_screen
jmp exit ; exit thread
 
save_screen:
 
pusha
 
; mov eax,5
; mov ebx,500
; int 0x40
 
; xor ebx,ebx
; mov edi,0x10036 ;0x10000
; mov esi,edi ;0x10000
; add esi,[i_size]
 
; ss1:
 
; mov eax,35
; int 0x40
 
; inc ebx
 
; mov [edi],eax
; add edi,3
 
; cmp edi,esi
; jb ss1
 
; 1) READ SCREEN
mov edi,0x10036
 
mov eax,[size_y]
dec eax
mov [temp_y],eax
 
ynew:
 
xor eax,eax
mov [temp_x],eax
 
xnew:
 
mov eax,[temp_x]
mov ebx,[temp_y]
call read_pixel
 
mov [edi],eax
add edi,3
 
inc [temp_x]
 
mov eax,[size_x]
cmp [temp_x],eax
jb xnew
 
dec [temp_y]
 
cmp [temp_y],0
jge ynew
 
; 2) BMP HEADER
 
mov [0x10000],word 'BM' ; bmp signature
mov eax,[i_size]
mov [0x10000+34],eax ; image size
mov ebx,0x36
mov [0x10000+10],ebx ; headers size
add eax,ebx
mov [0x10000+2],eax ; file size
mov [0x10000+14],dword 0x28
mov eax,[size_x]
mov [0x10000+18],eax ; x size
mov eax,[size_y]
mov [0x10000+22],eax ; y size
mov [0x10000+26],word 1
mov [0x10000+28],word 0x18 ; bpp = 24 = 0x18
 
; 3) SAVE FILE
 
mov eax,56
mov ebx,filename
mov edx,0x10000
mov ecx,[i_size]
add ecx,0x36
mov esi,path
int 0x40
 
popa
ret
 
filename db 'SCREEN BMP'
path db 0
 
read_pixel:
pushad
 
mov esi,eax
mov eax,[size_x]
mul ebx
add eax,esi
 
xchg eax,ebx
mov eax,35
int 0x40
mov [esp+28],eax
 
popad
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
movzx ebx,word [size_x]
shr ebx,2
add ebx,100*65536+40
 
movzx ecx,word [size_y]
shr ecx,2
add ecx,100*65536+75
 
mov edx,0x027777dd ;82 ; color of work area RRGGBB
mov esi,0x807777dd ; color of grab bar RRGGBB,8->color gl
mov edi,0x007777dd ; 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,0x10ffffff ; 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,[size_x]
shr ebx,2
add ebx,40-19
shl ebx,16
mov bx,12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
xor edx,edx ; button id
inc edx
mov esi,0x7777dd ; button color RRGGBB
int 0x40
 
; save image
mov ebx,20*65536
mov bx,word [size_x]
shr bx,2
mov cx,word [size_y]
shr cx,2
add cx,49
shl ecx,16
mov cx,12
mov edx,2
mov esi,0x4f4f9f
int 0x40
 
shr ecx,16
mov ebx,25*65536
mov bx,cx
add bx,3
mov eax,4
mov ecx,0xffffff
mov edx,savetext
mov esi,24 ;22
int 0x40
 
call draw_screen
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
draw_screen:
 
pusha
 
mov edi,scr
 
xor ecx,ecx
xor edx,edx
 
xor esi,esi
 
ds1:
 
mov eax,35
mov ebx,esi
int 0x40
stosd
dec edi
 
add esi,4
inc ecx
cmp ecx,[cmp_ecx] ; 800/4
jb ds1
 
add esi,[add_esi] ; 800*3
xor ecx,ecx
inc edx
cmp edx,[cmp_edx] ; 600/4
jb ds1
 
mov eax,7
mov ebx,scr
mov ecx,200*65536+160
mov ecx,[size_x]
shr ecx,2
shl ecx,16
mov cx,word [size_y]
shr cx,2
mov edx,20*65536+35
int 0x40
 
popa
 
ret
 
draw_magnify:
 
pusha
 
mov [m_x],dword 0x0
mov [m_y],dword 0x0
 
xor ecx,ecx
xor edx,edx
 
dm1:
 
push edx
mov eax,edx
mul [size_x]
pop edx
add eax,ecx
 
mov ebx,eax
mov eax,35
int 0x40
 
pusha
mov ebx,ecx
mov ecx,edx
shl ebx,3
add ebx,20
shl ebx,16
mov bx,8
shl ecx,3
add ecx,35
shl ecx,16
mov cx,8
 
mov edx,eax
mov eax,13
int 0x40
popa
 
inc ecx
cmp ecx,40
jnz dm1
xor ecx,ecx
inc edx
cmp edx,32
jnz dm1
 
popa
ret
 
; DATA AREA
 
i_size dd 0x1
 
m_x dd 100
m_y dd 100
 
cmp_ecx dd 0
add_esi dd 0
cmp_edx dd 0
 
delay dd 100
 
labelt:
db 'VIRTUAL SCREEN 2'
labellen:
 
savetext db 'SAVE AS /HD/1/SCREEN.BMP '
 
I_END:
 
temp_x dd ?
temp_y dd ?
 
size_x dd ?
size_y dd ?
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/xpaint/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:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/xpaint/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:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/xpaint/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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/xpaint/trunk/ascml.inc
0,0 → 1,93
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Massive operation
; Libary
;
; Ver 0.1 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 readmas,compmas,findmas
 
macro readmas masoff,obroff
{
local loo
mov edi,masoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
}
 
macro compmas masoff1,masoff2,obroff
{
local loo,loo2
mov esi,masoff2
add esi,8
mov ecx,[masoff2]
mov ebx,[masoff2+4]
mov eax,0
 
loo2:
push eax
 
mov edi,masoff1
add edi,8
mov ebp,[masoff1] ;elements1
mov edx,[masoff1+4] ;elemsize1
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
 
add esi,ebx
pop eax
inc eax
cmp eax,ecx
jne loo2
}
 
 
macro findmas masoff,obroff
{
local loo,looend,lend
mov edi,masoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
mov eax,0
call obroff
cmp eax,1
je looend
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
stc
jmp lend
looend:
popad
clc
lend:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/xpaint/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm xpaint.asm xpaint
@pause
/programs/xpaint/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm xpaint.asm xpaint
@pause
/programs/xpaint/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 <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/xpaint/trunk/xpaint.asm
0,0 → 1,1706
;
; Show Mini Sample by Pavlushin Evgeni for ASCL
; www.waptap@mail.ru
;
 
;bits brushes(right mouse button)!
;resize pucture(cross buttons)!
;Open BMP MIA MHI grafic files!
;Save as MIA MHI(zip from MHC -70% size)!
;Support full files 800*600
;Open and save dialogs is work!
 
; 27Ver Gif load support
; 28Ver Dialogs is work
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IM_END ; size of image
dd I_END ; memory for app
dd I_END ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
include 'lang.inc'
include 'macros.inc'
include 'ascl.inc'
include 'ascgl.inc'
 
hashtable equ MHC_END
ifile equ MHC_END+65536*8 ;4
ofile equ (MHC_END+65536*8)+2000000 ;1000000
 
gif_hash_offset = ofile
 
START: ; start of execution
mov eax,40
mov ebx,0100111b
int 0x40
 
; clear picture color White
mov ecx,1024*768*3
mov eax,0xffffffff
mov edi,image_area
cld
rep stosb
 
call draw_window
call setbrush
 
rstill:
mov eax,37
mov ebx,1
int 0x40
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
sub eax,5+6
sub ebx,22+30+6
 
cmp eax,640 ;for detect out of screen
ja still
cmp ebx,480
ja still
mov [xt],ebx
mov [yt],eax
 
still:
mov eax,40
mov ebx,0100111b
int 0x40
 
wtevent red,key,button
 
mov ebx,2
mov eax,37
int 0x40
cmp eax,1
je tescor ;if left button not pressed!
cmp eax,2
je cbr ;if right button pressed!
jmp rstill
; jmp still
 
cbr:
cmp dword [brush],9 ;9 brush matrix
jnae nocr
mov [brush],-1 ;0
nocr:
inc [brush]
call setbrush
jmp still
 
;Set brush
setbrush:
mov eax,[brush]
mov ebx,4*32
mul ebx
 
mov ecx,4*32
mov esi,brushtable
add esi,eax
mov edi,matrix
cld
rep movsb
 
delay 10
ret
 
tescor:
mov eax,37
mov ebx,1
int 0x40
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
sub eax,5+6
sub ebx,22+30+6
 
push eax
push ebx
 
mov ecx,eax ;[yt]
mov edx,ebx ;[xt]
 
mov eax,[xt]
mov ebx,[yt]
pop [xt]
pop [yt]
 
call line
 
; mov [yt],eax
; mov [xt],ebx
call out_image
 
jmp still
 
red:
call draw_window
jmp still
 
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 noclose
mov eax,-1 ; close this program
int 0x40
noclose:
cmp ah,10
jb no_palbut
cmp ah,10+32;64
ja no_palbut
mov ecx,0
mov cl,ah
sub cl,10
shl ecx,2
mov ebx,[colortable+ecx]
mov [color],ebx
 
;Update color boxes
drawfbox 20,32,20,15,[backcolor]
drawfbox 12,28,20,15,[color]
 
jmp still
no_palbut:
 
cmp ah,6
jne no_left
 
mov esi,0
mov edi,0
mov ebp,[img_ysize]
x_pls:
mov ecx,0
mov edx,[img_xsize]
x_pl:
mov al,[image_area+edi+ecx]
mov [image_area+esi+ecx],al
mov al,[image_area+edi+ecx+1]
mov [image_area+esi+ecx+1],al
mov al,[image_area+edi+ecx+2]
mov [image_area+esi+ecx+2],al
add ecx,3
dec edx
jnz x_pl
add edi,[img_xsize]
add edi,[img_xsize]
add edi,[img_xsize]
add esi,[img_xsize]
add esi,[img_xsize]
add esi,[img_xsize]
sub esi,3
dec ebp
jns x_pls
 
dec [img_xsize]
jmp red
no_left:
 
 
cmp ah,7
jne no_right
 
mov eax,[img_xsize]
mul [img_ysize]
mov ebx,3
mul ebx
mov edi,eax
 
mov eax,[img_xsize]
inc eax
mul [img_ysize]
mov ebx,3
mul ebx
mov esi,eax
 
; mov esi,0
; mov edi,0
mov ebp,[img_ysize]
x_mns:
mov ecx,[img_xsize] ;0
add ecx,[img_xsize]
add ecx,[img_xsize]
mov edx,[img_xsize]
x_mn:
mov al,[image_area+edi+ecx]
mov [image_area+esi+ecx],al
mov al,[image_area+edi+ecx+1]
mov [image_area+esi+ecx+1],al
mov al,[image_area+edi+ecx+2]
mov [image_area+esi+ecx+2],al
sub ecx,3
dec edx
jnz x_mn
mov dword [image_area+esi+ecx+0],0xffffffff
sub edi,[img_xsize]
sub edi,[img_xsize]
sub edi,[img_xsize]
sub esi,[img_xsize]
sub esi,[img_xsize]
sub esi,[img_xsize]
sub esi,3
dec ebp
jns x_mns
 
inc [img_xsize]
jmp red
no_right:
 
cmp ah,8
jne no_up
dec [img_ysize]
jmp red
no_up:
 
cmp ah,9
jne no_down
inc [img_ysize]
jmp red
no_down:
 
;SAVE MIA
cmp ah,80
jne no_save
savedialog draw_window, mia_is_save, still, string
mia_is_save:
mov dword [fileinfo],1 ;write
mov eax,[img_xsize]
mul [img_ysize]
mov edx,eax
add edx,eax
add edx,eax
add edx,8
cmp edx,1024*768*3+20000
ja still
mov dword [fileinfo+12],image ;from read
mov dword [fileinfo+8],edx ;1
mov eax,58
mov ebx,fileinfo
int 0x40
; puttxt 20,4,string,40,cl_White
jmp still
no_save:
 
;OPEN MIA
cmp ah,81
jne no_open
opendialog draw_window, mia_is_open, still, string
mia_is_open:
mov dword [fileinfo],0 ;read
mov dword [fileinfo+12],image ;from read
mov dword [fileinfo+8],1
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,ebx
shr eax,9
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
; puttxt 20,4,string,40,cl_White
jmp red
no_open:
 
cmp ah,82
jne no_save_mhc
 
 
savedialog draw_window, mhi_is_save, still, string
mhi_is_save:
call fill_filebufs
mov eax,[img_xsize]
mul [img_ysize]
mov edx,eax
add edx,eax
add edx,eax
add edx,8
mov ecx,edx
mov esi,image
mov edi,ifile
cld
rep movsb
mov eax,edx
call compress
cmp edx,1024*768*3+20000
ja still
mov dword [fileinfo],1 ;write
mov dword [fileinfo+12],ofile ;from read
mov dword [fileinfo+8],edx ;1
mov eax,58
mov ebx,fileinfo
int 0x40
; puttxt 20,4,string,40,cl_White
jmp still
 
no_save_mhc:
 
;OPEN MHI
cmp ah,83
jne no_open_mhc
 
opendialog draw_window, mhi_is_open, still, string
mhi_is_open:
 
call fill_filebufs
 
mov dword [fileinfo],0 ;read
mov dword [fileinfo+12],ofile ;ofile for decompress
mov dword [fileinfo+8],1
mov eax,58
mov ebx,fileinfo
int 0x40
push ebx ;push file size
mov eax,ebx
shr eax,9
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
 
; puttxt 20,4,string,40,cl_White
; delay 100
pop eax ;pop file size
call decompress
 
mov ecx,edx
mov esi,ifile ;image
mov edi,image ;ifile
cld
rep movsb
 
jmp red
no_open_mhc:
 
cmp ah,84
jne no_save_bmp
jmp still
no_save_bmp:
 
cmp ah,85
jne no_open_bmp
 
opendialog draw_window, bmp_is_open, still, string
 
bmp_is_open:
mov dword [fileinfo],0 ;read
mov dword [fileinfo+12],MHC_END ;from read
 
mov dword [fileinfo+8],1
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[MHC_END+2]
shr eax,9
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
 
; puttxt 20,4,string,40,cl_White
bmptoimg MHC_END,image
 
jmp red
 
no_open_bmp:
 
 
cmp ah,86
jne no_save_gif
jmp still
no_save_gif:
 
cmp ah,87
jne no_open_gif
 
opendialog draw_window, gif_is_open, still, string
 
gif_is_open:
mov dword [fileinfo],0 ;read
mov dword [fileinfo+12],MHC_END ;from read
 
mov dword [fileinfo+8],1
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[MHC_END+2]
shr eax,9
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
 
puttxt 20,4,string,40,cl_White
giftoimg MHC_END,image
 
jmp red
 
no_open_gif:
 
 
 
cmp ah,100
jne nor1
 
mov eax,[img_xsize]
mul [img_ysize]
mov edx,eax
add edx,eax
add edx,eax
mov esi,image+8
norx:
mov al,byte [esi+2]
and al,01b ;10000000b
cmp al,0
jna xe
; mov al,255
mov byte [esi],0;255
mov byte [esi+1],0;0
mov byte [esi+2],255;0
jmp xa
xe:
mov byte [esi],255
mov byte [esi+1],255
mov byte [esi+2],255
xa:
add esi,3
cmp esi,edx
jnae norx
jmp red
nor1:
 
jmp still
 
fileinfo:
dd 0
dd 0
dd 1
dd MHC_END
dd out_image_area ;16384
string:
times 256 db 0
;times 256 db 0
;times 256 db 0
 
;filename db "IMAGE MIA"
;mhcfilename db "IMAGE MHI"
 
soi dd 0
pxs dd 0
pys dd 0
 
out_image:
mov eax,[prcinfo.x_size]
sub eax,21
cmp eax,[img_xsize] ;640
jna no_x
mov eax,[img_xsize] ;640
no_x:
mov [pxs],eax
mov eax,[prcinfo.y_size]
sub eax,68
cmp eax,[img_ysize] ;480
jna no_y
mov eax,[img_ysize] ;480
no_y:
mov [pys],eax
 
mov eax,[pxs]
cmp eax,[img_xsize] ;640
jne trans
mov eax,[pys]
cmp eax,[img_ysize] ;480
jne trans
 
mov eax,7
mov ebx,image_area
mov ecx,[pxs] ;640
shl ecx,16
add ecx,[pys] ;480
mov edx,(5+6)*65536+(22+6+30) ;+30 Reserve for buttons
int 0x40
ret
 
trans:
mov ebp,[pys]; 180
mov esi,image_area
mov edi,out_image_area
loox:
mov ecx,[pxs] ;200*3
add ecx,[pxs]
add ecx,[pxs]
cld
rep movsb
mov eax,[img_xsize] ;640
sub eax,[pxs]
add esi,eax
add esi,eax
add esi,eax
 
dec ebp
jnz loox
 
mov eax,7
mov ebx,out_image_area
mov ecx,[pxs]
shl ecx,16
add ecx,[pys]
 
mov edx,(5+6)*65536+(22+6+30) ;+30 Reserve for buttons
int 0x40
ret
 
 
;set put to massive
puti:
mov eax,edx
mov ebx,ecx
 
setput:
pushad
cmp eax,[img_xsize] ;640
jae nosetput
cmp ebx,[img_ysize] ;480
jae nosetput
mov edi,ebx
mov ebx,3 ;x*3
mul ebx
mov esi,eax
mov eax,[img_xsize] ;640*3 ;Y*640*3
add eax,[img_xsize]
add eax,[img_xsize]
mov ebx,edi
mul ebx
add eax,esi
 
mov ebp,[img_xsize]
shl ebp,4
add ebp,16
mov esi,ebp
add esi,ebp
add esi,ebp
 
sub eax,esi ;(16+640*16)*3
 
mov esi,0
mlix:
push eax
 
mov edi,[matrix+esi*4]
mloo:
shr edi,1
jnc nosp
; cmp eax,640*480*3 ;for detect out of screen
; jae nosp
push eax
mov eax,[img_xsize]
mul [img_ysize]
mov ebx,eax
add ebx,eax
add ebx,eax
pop eax
cmp eax,ebx
jae nosp
 
mov ebx,[color]
mov byte [image_area+eax],bl ;0x00ff
shr ebx,8
mov byte [image_area+eax+1],bl ;0x33
shr ebx,8
mov byte [image_area+eax+2],bl ;0x33
nosp:
add eax,3
cmp edi,0
jne mloo
 
pop eax
add eax,[img_xsize] ;640*3
add eax,[img_xsize]
add eax,[img_xsize]
inc esi
cmp esi,32
jnae mlix
 
nosetput:
popad
ret
 
matrix:
times 32 dd 0
 
brushtable:
;standart put
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
times 12 dd 0
 
;put size 2
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000011000000000000000b
dd 00000000000000011000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
times 12 dd 0
 
;put size 3
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000111000000000000000b
dd 00000000000000111000000000000000b
dd 00000000000000111000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
times 12 dd 0
 
;put size 4
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000111000000000000000b
dd 00000000000001111100000000000000b
dd 00000000000001111100000000000000b
dd 00000000000001111100000000000000b
dd 00000000000000111000000000000000b
dd 00000000000000000000000000000000b
times 12 dd 0
 
 
;put slash ld-ru
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000000000010000000000000b
dd 00000000000000000100000000000000b
dd 00000000000000001000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000100000000000000000b
dd 00000000000001000000000000000000b
dd 00000000000010000000000000000000b
times 12 dd 0
 
;put slash lu-rd
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000010000000000000000000b
dd 00000000000001000000000000000000b
dd 00000000000000100000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000001000000000000000b
dd 00000000000000000100000000000000b
dd 00000000000000000010000000000000b
times 12 dd 0
 
;pricel
times 8 dd 0
dd 00000000000000000000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000011111110000000000000b
dd 00000000000010010010000000000000b
dd 00000000000010000010000000000000b
dd 00000000111111010111111000000000b
dd 00000000000010000010000000000000b
dd 00000000000010010010000000000000b
dd 00000000000011111110000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000010000000000000000b
times 8 dd 0
 
;krest
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000010000010000000000000b
dd 00000000000001000100000000000000b
dd 00000000000000101000000000000000b
dd 00000000000000010000000000000000b
dd 00000000000000101000000000000000b
dd 00000000000001000100000000000000b
dd 00000000000010000010000000000000b
times 12 dd 0
 
;krest
times 12 dd 0
dd 00000000000000000000000000000000b
dd 00000000000010000010000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000000000000000000000000b
dd 00000000000010000010000000000000b
times 12 dd 0
 
 
;smile
times 8 dd 0
dd 00000111110000000000000b
dd 00011000001100000000000b
dd 00100000000010000000000b
dd 01000000000001000000000b
dd 01000000000001000000000b
dd 10001100011000100000000b
dd 10001100011000100000000b
dd 10000000000000100000000b
dd 10000000000000100000000b
dd 10010000000100100000000b
dd 01001000001001000000000b
dd 01000111110001000000000b
dd 00100000000010000000000b
dd 00011000001100000000000b
dd 00000111110000000000000b
dd 00000000000000000000000000000000b
times 8 dd 0
 
;round
dd 00000000000111111111100000000000b
dd 00000000011000000000011000000000b
dd 00000001100000000000000110000000b
dd 00000010000000000000000001000000b
dd 00000100000000000000000000100000b
dd 00001000000000000000000000010000b
dd 00010000000000000000000000001000b
dd 00100000000000000000000000000100b
dd 00100000000000000000000000000100b
dd 01000000000000000000000000000010b
dd 01000000000000000000000000000010b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 10000000000000000000000000000001b
dd 01000000000000000000000000000010b
dd 01000000000000000000000000000010b
dd 00100000000000000000000000000100b
dd 00100000000000000000000000000100b
dd 00010000000000000000000000001000b
dd 00001000000000000000000000010000b
dd 00000100000000000000000000100000b
dd 00000010000000000000000001000000b
dd 00000001100000000000000110000000b
dd 00000000011000000000011000000000b
dd 00000000000111111111100000000000b
 
 
;Draw line procedure
line:
jmp n
previous_X dw -1
previous_Y dw -1
X_increment dw -1
Y_increment dw -1
n:
push ax
push bx
push cx
push dx
pop cx ;yed
pop dx ;xed
pop [previous_Y]
pop [previous_X]
 
mov ax,cx
sub ax,[previous_X]
jns dx_pos
neg ax
mov [X_increment],1
jmp dx_neg
dx_pos: mov [X_increment],-1
dx_neg: mov bx,dx
sub bx,[previous_Y]
jns dy_pos
neg bx
mov [Y_increment],1
jmp dy_neg
dy_pos: mov [Y_increment],-1
dy_neg: shl ax,1
shl bx,1
pusha
call puti
popa
cmp ax,bx
jna dx_le_dy
mov di,ax
shr di,1
neg di
add di,bx
cycle:
cmp cx,[previous_X]
je exit_bres
cmp di,0
jl fractlt0
add dx,[Y_increment]
sub di,ax
fractlt0:
add cx,[X_increment]
add di,bx
pusha
call puti
popa
jmp cycle
dx_le_dy:
mov di,bx
shr di,1
neg di
add di,ax
cycle2:
cmp dx,[previous_Y]
je exit_bres
cmp di,0
jl fractlt02
add cx,[X_increment]
sub di,bx
fractlt02:
add dx,[Y_increment]
add di,ax
pusha
call puti
popa
jmp cycle2
exit_bres:
ret
 
 
draw_window:
startwd
window 40,40,(586+8),(380+24),window_Skinned+0x00ffffff
label 12,8,'2D EXAMPLE: ASCL XPAINT',cl_White+font_Big
 
; Get proc info
mov eax,9
mov ebx,prcinfo
mov ecx,-1
int 0x40
 
mov eax,[prcinfo.x_size]
mov ebp,[prcinfo.y_size]
sub eax,5+4
sub ebp,22+4
 
drawfbox 5,22,eax,ebp,0x00e0f0f4
; call out_image
 
; draw resize buttons
mov eax,8
mov ebx,(341)*65536+9
mov ecx,(22+6+6)*65536+6
mov edx,6 ;start with 6
mov esi,0x00aaaaaa
int 0x40
inc edx
add ebx,15*65536
int 0x40
mov ebx,(340+10)*65536+6
mov ecx,(22+6-2)*65536+8
inc edx
mov esi,0x00aaaaaa
int 0x40
inc edx
add ecx,14*65536
int 0x40
 
;Draw now and back color
drawfbox 20,32,20,15,[backcolor]
drawfbox 12,28,20,15,[color]
 
 
;Draw buttons color set
mov eax,8
mov ebx,(40+6)*65536+8
mov ecx,(22+6)*65536+8
mov edx,10 ;start with 10
mov edi,0
nextbut:
mov esi,dword [colorbuttable+edi*4]
int 0x40
add ecx,(10)*65536
inc edx
inc edi
mov esi,dword [colorbuttable+edi*4]
int 0x40
sub ecx,(10)*65536
add ebx,(10)*65536
inc edx
inc edi
cmp edi,32 ;64 buttons, 2 string of 32 buttons
jnae nextbut
 
;Save as not ziped image button
mov eax,8
mov ebx,(365+6)*65536+50
mov ecx,(22+6)*65536+8
mov edx,80 ;ID
mov esi,cl_Grey
int 0x40
 
label (365+7),(22+7),"SAVE MIA",cl_White
 
;Open not zipped image button
mov eax,8
mov ebx,(365+6)*65536+50
mov ecx,(36+6)*65536+8
mov edx,81 ;ID
mov esi,cl_Grey
int 0x40
 
label (365+7),(36+7),"OPEN MIA",cl_White
 
;Save as MHC ziped image button
mov eax,8
mov ebx,(420+6)*65536+50
mov ecx,(22+6)*65536+8
mov edx,82 ;ID
mov esi,cl_Grey
int 0x40
 
label (420+7),(22+7),"SAVE MHI",cl_White
 
;Open MHC zipped image button
mov eax,8
mov ebx,(420+6)*65536+50
mov ecx,(36+6)*65536+8
mov edx,83 ;ID
mov esi,cl_Grey
int 0x40
 
label (420+7),(36+7),"OPEN MHI",cl_White
 
;Save as Bitmap image button
mov eax,8
mov ebx,(475+6)*65536+50
mov ecx,(22+6)*65536+8
mov edx,84 ;ID
mov esi,cl_Grey
int 0x40
 
label (475+7),(22+7),"SAVE NOT",cl_White
 
;Open Bitmap image button
mov eax,8
mov ebx,(475+6)*65536+50
mov ecx,(36+6)*65536+8
mov edx,85 ;ID
mov esi,cl_Grey
int 0x40
 
label (475+7),(36+7),"OPEN BMP",cl_White
 
;Save as GIF image button
mov eax,8
mov ebx,(530+6)*65536+50
mov ecx,(22+6)*65536+8
mov edx,86 ;ID
mov esi,cl_Grey
int 0x40
 
label (530+7),(22+7),"SAVE NOT",cl_White
 
;Open GIF image button
mov eax,8
mov ebx,(530+6)*65536+50
mov ecx,(36+6)*65536+8
mov edx,87 ;ID
mov esi,cl_Grey
int 0x40
 
label (530+7),(36+7),"OPEN GIF",cl_White
 
;Draw filter buttons
mov eax,8
mov ebx,(590+6)*65536+6
mov ecx,(22+6)*65536+6
mov edx,100 ;start with 100
mov edi,0
nextfbut:
mov esi,0x00aa0000
int 0x40
add ecx,(8)*65536
inc edx
inc edi
mov esi,0x0000aa00
int 0x40
add ecx,(8)*65536
inc edx
inc edi
mov esi,0x000000aa
int 0x40
sub ecx,(8*2)*65536
add ebx,(8)*65536
inc edx
inc edi
cmp edi,8*3 ;24 buttons, 3 string of 8 buttons
jnae nextfbut
 
 
endwd
call out_image
ret
 
 
; Get from MHC Archiver by Nikita Lesnikov
; ======== compression/decompression engine ========
 
compress: ; File compression
 
compress_filefound:
 
jmp lzp_compress ; compress with order-2 LZP
compress_dumpdata:
 
ret
 
decompress: ; File decompression
 
decompress_filefound:
 
cmp byte [ofile],0 ; Invalid method!
jz right_method
mov edx,0 ;0 size
ret
 
right_method:
 
jmp lzp_decompress
decompress_dumpdata:
 
ret
 
fill_filebufs: ; Fill filebufs with garbage to simplify matching
pusha
cld
mov eax,0xF7D9A03F ; <- "magic number" :) just garbage...
mov ecx,2000000/2 ;4
mov edi,ifile
rep stosd
popa
ret
 
; ==== algorithms section ====
 
; Method 0: LZP compression algorithm
 
lzp_compress: ; EDX - how much bytes to dump
 
cld ; clear direction flag
 
mov esi,ifile ; init pointers
mov edi,ofile
 
push eax ; write header: ID0+4bfilesize => total 5 bytes
xor eax,eax
stosb
pop eax
stosd
 
pusha ; fill hash table
mov eax,ifile
mov edi,hashtable
mov ecx,65536*2 ;*1
rep stosd
popa
 
add eax,esi ; calculate endpointer
mov dword [endpointer],eax
 
movsw ; copy three bytes
movsb
 
mov dword [controlp],edi
inc edi
 
mov byte [controld],0
mov byte [controlb],0
 
c_loop:
cmp dword [endpointer],esi ; check end of file
ja c_loop_ok
jmp finish_c_loop
c_loop_ok:
 
call chash
call compare
jz two_match_c
 
lodsb
mov byte [literal],al
call chash
call compare
jz lit_match_c
 
mov al,0
call putbit
mov al,byte [literal]
stosb
movsb
jmp end_c_loop
 
lit_match_c:
mov al,1
call putbit
mov al,0
call putbit
mov al,byte [literal]
stosb
jmp encode_match
 
two_match_c:
mov al,1
call putbit
call putbit
 
encode_match:
call incpos
call compare
jz one_c
mov al,0
call putbit
jmp end_c_loop
one_c:
 
call incpos
mov al,1
call putbit
 
call compare
jnz ec1
call incpos
call compare
jnz ec2
call incpos
call compare
jnz ec3
call incpos
mov al,1
call putbit
call putbit
call compare
jnz ec4
call incpos
call compare
jnz ec5
call incpos
call compare
jnz ec6
call incpos
call compare
jnz ec7
call incpos
call compare
jnz ec8
call incpos
call compare
jnz ec9
call incpos
call compare
jnz ec10
call incpos
 
mov al,1
call putbit
call putbit
call putbit
xor ecx,ecx
 
match_loop_c:
cmp esi,dword [endpointer]
jae out_match_loop_c
call compare
jnz out_match_loop_c
inc ecx
call incpos
jmp match_loop_c
out_match_loop_c:
 
mov al,0xFF
out_lg:
cmp ecx,255
jb out_lg_out
stosb
sub ecx,255
jmp out_lg
out_lg_out:
mov al,cl
stosb
jmp end_c_loop
 
ec10:
mov al,1
call putbit
call putbit
mov al,0
call putbit
jmp end_c_loop
 
ec9:
mov al,1
call putbit
mov al,0
call putbit
mov al,1
call putbit
jmp end_c_loop
 
ec8:
mov al,1
call putbit
mov al,0
call putbit
call putbit
jmp end_c_loop
 
ec7:
mov al,0
call putbit
mov al,1
call putbit
call putbit
jmp end_c_loop
 
ec6:
mov al,0
call putbit
mov al,1
call putbit
mov al,0
call putbit
jmp end_c_loop
 
ec5:
mov al,0
call putbit
call putbit
mov al,1
call putbit
jmp end_c_loop
 
ec4:
mov al,0
call putbit
call putbit
call putbit
jmp end_c_loop
 
ec3:
mov al,1
call putbit
mov al,0
call putbit
jmp end_c_loop
 
ec2:
mov al,0
call putbit
mov al,1
call putbit
jmp end_c_loop
 
ec1:
mov al,0
call putbit
call putbit
 
end_c_loop:
jmp c_loop
 
finish_c_loop:
 
mov eax,dword [controlp] ; store last tagbyte
mov bl,byte [controld]
mov [eax], byte bl
 
sub edi,ofile ; calculate dump size
mov edx,edi
 
jmp compress_dumpdata
 
; LZP decompression algorithm
 
lzp_decompress: ; EDX - how much bytes to dump
 
cld
 
mov edi,ifile
mov esi,ofile+1
 
pusha ; fill hash table
mov eax,ifile
mov edi,hashtable
mov ecx,65536*2 ;*1
rep stosd
popa
 
lodsd
 
mov ebx,edi
add ebx,eax
mov dword [endpointer],ebx
 
movsw
movsb
 
lodsb
mov byte [controld],al
mov byte [controlb],0
 
d_loop:
cmp dword [endpointer],edi
ja d_loop_ok
jmp finish_d_loop
d_loop_ok:
 
call getbit
cmp al,0
jnz match_d
call dhash
movsb
call dhash
movsb
jmp end_d_loop
 
match_d:
 
call getbit
cmp al,0
jnz no_literal_before_match
call dhash
movsb
no_literal_before_match:
 
call dhash
mov ecx,1
call copymatch
 
call getbit
cmp al,0
jz end_d_loop
mov ecx,1
call copymatch
call getbit
cmp al,0
jz dc2
mov ecx,2
call copymatch
call getbit
cmp al,0
jz end_d_loop
mov ecx,1
call copymatch
call getbit
cmp al,0
jz dc4
mov ecx,4
call copymatch
call getbit
cmp al,0
jz dc5
call getbit
cmp al,0
jz dc6
mov ecx,3
call copymatch
 
do:
lodsb
xor ecx,ecx
mov cl,al
call copymatch
cmp al,0xFF
jnz end_do
jmp do
end_do:
jmp end_d_loop
 
dc6:
mov ecx,2
call copymatch
jmp end_d_loop
 
dc5:
call getbit
cmp al,0
jz ndc5
mov ecx,1
call copymatch
ndc5:
jmp end_d_loop
 
dc4:
call getbit
cmp al,0
jz ndc4
call getbit
mov ecx,3
cmp al,1
jz ndcc4
dec ecx
ndcc4:
call copymatch
jmp end_d_loop
ndc4:
call getbit
cmp al,0
jz ndccc4
mov ecx,1
call copymatch
ndccc4:
jmp end_d_loop
 
dc2:
call getbit
cmp al,0
jz ndc2
mov ecx,1
call copymatch
ndc2:
 
end_d_loop:
jmp d_loop
finish_d_loop:
 
mov edx, dword [ofile+1]
 
jmp decompress_dumpdata
 
; LZP subroutines
 
putbit: ; bit -> byte tag, AL holds bit for output
pusha
mov cl,byte [controlb]
shl al,cl
mov bl,byte [controld]
or bl,al
mov byte [controld],bl
inc cl
cmp cl,8
jnz just_increment
mov byte [controlb],0
mov byte [controld],0
push edi
mov edi, dword [controlp]
mov al,bl
stosb
pop edi
mov dword [controlp],edi
popa
inc edi
ret
just_increment:
mov byte [controlb],cl
popa
ret
 
getbit: ; tag byte -> bit, AL holds input
push ecx
mov al,byte [controld]
mov cl,byte [controlb]
shr al,cl
and al,1
inc cl
cmp cl,8
jnz just_increment_d
mov byte [controlb],0
push eax
lodsb
mov byte [controld],al
pop eax
pop ecx
ret
just_increment_d:
mov byte [controlb],cl
pop ecx
ret
 
chash: ; calculate hash -> mp -> fill position
pusha
xor eax,eax
mov al, byte [esi-1]
mov ah, byte [esi-2]
shl eax,2
add eax,hashtable
mov edx,dword [eax]
mov dword [mp],edx
mov dword [eax],esi
popa
ret
 
dhash: ; calculate hash -> mp -> fill position
pusha
xor eax,eax
mov al, byte [edi-1]
mov ah, byte [edi-2]
shl eax,2
add eax,hashtable
mov edx,dword [eax]
mov dword [mp],edx
mov dword [eax],edi
popa
ret
 
copymatch: ; ECX bytes from [mp] to [rp]
push esi
mov esi,dword [mp]
rep movsb
mov dword [mp],esi
pop esi
ret
 
compare: ; compare [mp] with [cpos]
push edi
push esi
mov edi,dword [mp]
cmpsb
pop esi
pop edi
ret
 
incpos:
inc dword [mp]
inc esi
ret
 
 
; LZP algorithm data
 
endpointer dd 0
controlp dd 0
controlb db 0
controld db 0
mp dd 0
literal db 0
 
; the end... - Nikita Lesnikov (nlo_one)
 
 
 
; DATA AREA
newline dd 0
xt dd 100
yt dd 100
counter dd 0
tsoi dd 0
view dd 0
brush dd 0
 
color dd 0x00000000
backcolor dd 0xffffff
 
colortable:
dd 0x00000000 ;black
dd 0x00FFFFFF ;white
dd 0x00808080 ;dark-gray
dd 0x00C0C0C0 ;gray
dd 0x00000080 ;dark-blue
dd 0x000000ff ;blue
dd 0x00400080 ;dark-violet
dd 0x008000ff ;violet
dd 0x00800080 ;dark-pink
dd 0x00ff00ff ;pink
dd 0x00800040 ;
dd 0x00ff0080 ;
dd 0x00800000 ;brown
dd 0x00ff0000 ;red
dd 0x00802000 ;
dd 0x00ff4000 ;dark-orange
dd 0x00804000 ;
dd 0x00ff8000 ;orange
dd 0x00804000 ;
dd 0x00ff8000 ;orange
dd 0x00808000 ;oliva
dd 0x00ffff00 ;yellow
dd 0x00608000 ;
dd 0x00C0ff00 ;
dd 0x00408000 ;green
dd 0x0080ff00 ;lime
dd 0x00008000 ;
dd 0x0000ff00 ;
dd 0x00008040 ;dark-salat
dd 0x0000ff80 ;salat
dd 0x00008080 ;dark-water
dd 0x0000ffff ;water
 
colorbuttable:
dd 0x001e1e1e ;black
dd 0x00dedede ;white
dd 0x00808080 ;dark-gray
dd 0x00C0C0C0 ;gray
dd 0x001e1e80 ;dark-blue
dd 0x001e1ede ;blue
dd 0x00401e80 ;dark-violet
dd 0x00801ede ;violet
dd 0x00801e80 ;dark-pink
dd 0x00de1ede ;pink
dd 0x00801e40 ;
dd 0x00de1e80 ;
dd 0x00801e1e ;brown
dd 0x00de1e1e ;red
dd 0x0080201e ;
dd 0x00de401e ;dark-orange
dd 0x0080401e ;
dd 0x00de801e ;orange
dd 0x0080401e ;
dd 0x00de801e ;orange
dd 0x0080801e ;oliva
dd 0x00dede1e ;yellow
dd 0x0060801e ;
dd 0x00C0de1e ;
dd 0x0040801e ;green
dd 0x0080de1e ;lime
dd 0x001e801e ;
dd 0x001ede1e ;
dd 0x001e8040 ;dark-salat
dd 0x001ede80 ;salat
dd 0x00008080 ;dark-water
dd 0x0000dede ;water
 
 
 
prcinfo process_information
 
;IM_END:
image:
img_xsize dd 200
img_ysize dd 180
IM_END:
image_area:
;rb 1024*768*3
 
out_image_area = image_area+(1024*768*3)
;rb 640*480*3
 
MHC_END = image_area+(1024*768*3)*2
I_END = MHC_END+6000000 ;6 megs for work mhc algorythm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/ym/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm ym.asm ym
@pause
/programs/ym/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ym.asm ym
@pause
/programs/ym/trunk/ym.asm
0,0 → 1,1087
; Yahoo Messanger for MenuetOS
; Compile with FASM for Menuet
;B+ System header
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x100000
dd 0x7fff0
dd 0x0,0x0
;E:.
include 'lang.inc'
;B+ Definitions
v_sp equ 330
h_sp equ 400
fr_sp equ 120
line_wid equ 45
fr_max_lines equ 17
;memory
sys_colors equ I_END
text_zone equ sys_colors+4*10
;friend_zone equ text_zone+45*25 ;uncom
;friend_zone+32*fr_max_lines
;E:.
START:
;B+ Main execution
call clear_text
red:
call draw_window
still:
mov ebx,50
mov eax,23
int 0x40
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
call check_message
jmp still
key:
mov eax,2
int 0x40
cmp [is_connect],0
je still
call send_key_string
jmp still
button:
mov eax,17
int 0x40
cmp ah,1
jne noclose
mov eax,-1
int 0x40
jmp $
noclose:
;B+ Check friend
cmp ah,2
jb .no_friend
cmp ah,100
ja .no_friend
;pressed number
sub ah,2
shr ax,8
;find real name
mov [friend_p],friend_zone
mov edi,0
.next:
push [friend_p]
call test_friend
jc .group
inc edi
.group:
cmp di,ax
pop ebx
jbe .next
inc ebx
;exact place
mov ecx,[friend_p]
sub ecx,ebx
dec ecx
;Insert in send
cmp al,10
jb .good
add al,'A'-'0'-10
.good:
add al,'0'
mov [view_text+1],al
;Clear old a. friend
pusha
mov ebx,(h_sp-140) shl 16 + 132
mov ecx,(v_sp-53) shl 16 + 10
mov edx,[sys_colors+4*5]
mov eax,13
int 0x40
popa
;show item
mov [f_name_b],ebx
mov [f_name_l],ecx
call show_a_friend
jmp still
.no_friend:
;E:.
;B+ Check User / Password
cmp ah,103
je input_username
cmp ah,104
je input_password
;E:.
;B+ Connect / Dis...
cmp ah,101
je yahoo_c
cmp ah,102
je yahoo_d
;E:.
jmp still
;E:.
draw_window:
;B+ Draw window
mov ebx,1
mov eax,12
int 0x40
mov ebx,3
mov ecx,sys_colors
mov edx,10*4
mov eax,48
int 0x40
mov ebx,150*65536+h_sp
mov ecx,100*65536+v_sp
mov edx,[sys_colors+4*5]
or edx,0x02000000
mov esi,[sys_colors+4*1]
or esi,0x80000000
mov edi,[sys_colors+4*0]
mov eax,0
int 0x40
mov ebx,8*65536+8
mov ecx,[sys_colors+4*4]
or ecx,0x10000000
mov edx,caption
mov esi,caption_end-caption
mov eax,4
int 0x40
mov ebx,(400-19) shl 16 + 12
mov ecx,5 shl 16 + 12
mov edx,1
mov esi,[sys_colors+4*2]
mov eax,8
int 0x40
;B+ Friend panel
mov ebx,(h_sp-fr_sp) shl 16 + 3
mov ecx,20 shl 16 + v_sp-31 -56
mov edx,[sys_colors+4*9]
mov eax,13
int 0x40
call show_friends
;E:.
;B+ Input panel
mov ebx,5 shl 16 + h_sp-9
mov ecx,(v_sp-31 -33-3) shl 16 + 3
mov edx,[sys_colors+4*9]
mov eax,13
int 0x40
mov ebx,(h_sp-(fr_sp-12)*8/6) shl 16 + 4
mov ecx,(v_sp-31-33) shl 16 + 30
int 0x40
mov ebx,(h_sp-8) shl 16 + 4
int 0x40
call show_a_friend
call show_string
;E:.
;B+ Login panel
mov ebx,5 shl 16 + h_sp-9
mov ecx,(v_sp-35) shl 16 + 31
mov edx,[sys_colors+4*9]
mov eax,13
int 0x40
mov ebx,(5+2+8+(user_txt_end-user_txt)*6) shl 16 + 6*15+7
mov ecx,(v_sp-32) shl 16 + 12
mov edx,[sys_colors+4*5]
int 0x40
mov ebx,(171+2+8+(psw_txt_end-psw_txt)*6) shl 16 + 6*23+7
mov ecx,(v_sp-32) shl 16 + 12
int 0x40
;connect button
mov ebx,(h_sp-128) shl 16 + (con_txt_end-con_txt)*6 + 7
mov ecx,(v_sp-18) shl 16 + 12
mov edx,101
mov esi,[sys_colors+4*6]
mov eax,8
int 0x40
;disconnect button
shl ebx,16
add ebx,(h_sp-128+3) shl 16 + (dis_txt_end-dis_txt)*6 + 7
mov edx,102
int 0x40
;user button
mov ebx,8 shl 16 + (user_txt_end-user_txt)*6 + 5
mov ecx,(v_sp-18-15) shl 16 + 12
mov edx,103
int 0x40
;password button
mov ebx,174 shl 16 + (psw_txt_end-psw_txt)*6 + 5
mov edx,104
int 0x40
;login text
mov ebx,11 shl 16 + v_sp-15
mov ecx,[sys_colors+4*7]
mov edx,login_txt
mov esi,login_txt_end-login_txt
mov eax,4
int 0x40
;user text
mov ebx,11 shl 16 + v_sp-15-15
mov edx,user_txt
mov esi,user_txt_end-user_txt
int 0x40
;password text
mov ebx,(174+5) shl 16 + v_sp-15-15
mov edx,psw_txt
mov esi,psw_txt_end-psw_txt
int 0x40
;connect text
mov ebx,(h_sp-128+5) shl 16 + v_sp-15
mov edx,con_txt
mov esi,con_txt_end-con_txt
int 0x40
;disconnect text
add ebx,((con_txt_end-con_txt)*6+8 + 3) shl 16
mov edx,dis_txt
mov esi,dis_txt_end-dis_txt
int 0x40
call show_username
call show_password
;E:.
call show_text
mov ebx,2
mov eax,12
int 0x40
ret
;E:.
show_friends:
;B+ Show friend list
cmp [last_friend_place],friend_zone
jne .yes_show
ret
.yes_show:
;show button
mov ebx,(h_sp-fr_sp+5) shl 16 + 10
mov ecx,(20+3) shl 16 + 10
mov edx,2
mov esi,[sys_colors+4*6]
mov eax,8
mov edi,0
mov [friend_p],friend_zone
.next_button:
call test_friend
jc .no_b
int 0x40
inc edx
.no_b:
inc edi
add ecx,15 shl 16
cmp edi,[last_friend_line]
jne .next_button
;show numbers
mov [digit],'0'-1
mov ebx,(h_sp-fr_sp+8) shl 16 + (20+3)+2
;mov ecx,[sys_colors+4*7]
mov edx,digit
mov esi,1
mov eax,4
mov edi,0
mov [friend_p],friend_zone
push edx
.next_digit:
mov edx,[friend_p]
call test_friend
cmp [edx],byte 1
je .no_item
inc [digit]
cmp [digit],'9'+1
jne .good
mov [digit],'A'
.good:
;add ebx,1 shl 16
cmp [edx],byte 2
mov edx,[esp]
mov ecx,[sys_colors+4*6]
call hi_light
jne .no_online
mov ecx,[sys_colors+4*7]
;int 0x40
;or ecx,0x10000000
.no_online:
;sub ebx,1 shl 16
int 0x40
;and ecx,not 0x10000000
.no_item:
add ebx,15
inc edi
cmp edi,[last_friend_line]
jne .next_digit
add esp,4
;show names
mov ebx,(h_sp-fr_sp+8 + 10) shl 16 + (20+3)+2
mov ecx,[sys_colors+4*8]
mov eax,4
mov edi,0
mov [friend_p],friend_zone
mov esi,4
.next_name:
mov edx,[friend_p]
call test_friend
mov esi,[friend_p]
inc edx
sub esi,edx
and ebx,0xffff
or ebx,(h_sp-fr_sp+8 + 10) shl 16
cmp [edx-1],byte 1
jne .no_group
sub ebx,12 shl 16
.no_group:
int 0x40
add ebx,15
inc edi
cmp edi,[last_friend_line]
jne .next_name
ret
.p db 16 ;>
digit db '0'
;last_friend_line dd 0x0 ;uncom
test_friend:
push eax
mov eax,[friend_p]
clc
cmp [eax],byte 1
jne .no_hide
stc
.no_hide:
pushf
.next:
inc [friend_p]
mov eax,[friend_p]
cmp [eax],byte 0
jne .next
inc [friend_p]
popf
pop eax
ret
friend_p dd 0x0
hi_light:
pushf
add ecx,0x400000
test ecx,0xb00000
jnz .no_red_plus
sub ecx,0x400000
.no_red_plus:
add ecx,0x004000
test ecx,0x00b000
jnz .no_green_plus
sub ecx,0x008000
.no_green_plus:
add ecx,0x000040 ;80
test ecx,0x0000b0 ;80
jnz .no_blue_plus
sub ecx,0x000040 ;100
.no_blue_plus:
popf
ret
;E:.
;B+ Message text op.
clear_text:
mov edi,text_zone
mov ecx,45*26
mov al,0
cld
rep stosb
ret
show_text:
mov ebx,7 shl 16 + (20+3) ;+ 2
mov ecx,[sys_colors+4*8]
mov edx,text_zone+45
mov esi,45
mov eax,4
mov edi,0
.next_line:
cmp [edx-1],byte 0
jne .shift
int 0x40
.next:
add ebx,10
add edx,45
inc edi
cmp edi,24
jne .next_line
ret
.shift:
add ebx,3 shl 16
int 0x40
sub ebx,3 shl 16
jmp .next
scroll_text:
pusha
;move text
mov edi,text_zone
mov esi,edi
add esi,line_wid
mov ecx,line_wid*24
cld
rep movsb
;clear last line
mov ecx,line_wid
mov al,0
rep stosb
;clear zone
mov ebx,7 shl 16 + line_wid*6+2
mov ecx,(25-2) shl 16 + 24*10-2 +2
mov edx,[sys_colors+4*5]
mov eax,13
int 0x40
;show text
call show_text
popa
ret
show_message:
;ebx - begin
;ecx - length
mov eax,[.m_p]
add eax,ecx
.test:
cmp eax,text_zone+line_wid*25-1
jb .good1
call scroll_text
sub eax,line_wid
sub [.m_p],line_wid
jmp .test
.good1:
cmp [.m_p],text_zone+line_wid
jae .good2
add ebx,line_wid
add [.m_p],line_wid
sub ecx,line_wid
jmp .good1
.good2:
;
push ecx
mov esi,ebx
mov edi,[.m_p]
cld
rep movsb
pop ecx
;find v place
mov eax,[.m_p]
sub eax,text_zone+line_wid
mov ebx,line_wid
xor edx,edx
div ebx
xor edx,edx
mov ebx,10
mul ebx
mov ebx,eax
;show line
add ebx,7 shl 16 + 23 ;+2
mov ecx,[sys_colors+4*8]
mov edx,[.m_p]
mov esi,line_wid
mov eax,4
int 0x40
add ebx,3 shl 16
.next_line:
add ebx,10
add edx,line_wid
cmp [edx-1],byte 0
je .good3
int 0x40
jmp .next_line
.good3:
mov [.m_p],edx
ret
.m_p dd text_zone+45
;E:.
;B+ Show current people
show_a_friend:
mov ebx,(h_sp-137) shl 16 + v_sp-52
mov ecx,[sys_colors+4*8]
or ecx,0x10000000
mov edx,[f_name_b]
mov esi,[f_name_l]
mov eax,4
int 0x40
ret
f_name_b dd fnb
f_name_l dd 10
fnb:
db 'yahoo_help'
;E:.
;B+ Input strings
send_key_string:
;B+ Test active keys
cmp ah,13
je send_text
cmp ah,27
je clear_input_text
cmp ah,8
je .backs_text
;E:.
mov [.this_c],ah
cmp [.c_pl],123
jne .show
ret
.show:
;save char
mov ebx,[.c_pl]
mov [in_text+ebx],ah
inc [.c_pl]
;show char
mov ebx,[.xy]
mov ecx,[sys_colors+4*8]
mov edx,.this_c
mov esi,1
mov eax,4
int 0x40
;
cmp [.c_pl],41
je .new_line
cmp [.c_pl],82
je .new_line
add [.xy],6 shl 16
call show_cursor
ret
;;;
.new_line:
and [.xy],0x0000ffff
add [.xy],9 shl 16 + 9
call show_cursor
ret
.this_c db ' '
.c_pl dd 0x0
.xy dd 7 shl 16 + v_sp-62
;B+ Special keys - action
.backs_text:
;
cmp [.c_pl],0
jne .yes_back
ret
.yes_back:
cmp [.c_pl],41
je .back_line
add [.xy],2 shl 16
cmp [.c_pl],82
je .back_line
sub [.xy],2 shl 16
.next:
;
sub [.xy],6 shl 16
dec [.c_pl]
mov eax,[.c_pl]
mov bl,[in_text+eax]
mov [.this_c],bl
mov ebx,[.xy]
mov ecx,[sys_colors+4*5]
mov edx,.this_c
mov esi,1
mov eax,4
int 0x40
mov ebx,[.c_pl]
mov [in_text+ebx],byte 0
jmp show_cursor
;
.back_line:
;and [.xy],0x0000ffff
sub [.xy],9
add [.xy],(253-9) shl 16
jmp .next
send_text:
;show text to message board
mov ebx,view_text
mov ecx,[send_key_string.c_pl]
add ecx,3
call show_message
;send message to internet
;call internet_send
clear_input_text:
;prepare new message
;; clear memory
mov edi,in_text
mov ecx,255/4
xor eax,eax
cld
rep stosd
;; clear zone
mov ebx,5 shl 16 + h_sp-140-9
mov ecx,(v_sp-31 -33) shl 16 + 29
mov edx,[sys_colors+4*5]
mov eax,13
int 0x40
;; move cursor
mov ebx,7 shl 16 + v_sp-62
mov [send_key_string.xy],ebx
mov [show_cursor.old_xy],ebx
;; clear place
xor ebx,ebx
mov [send_key_string.c_pl],ebx
; call show_cursor
; ret
;E:.
show_cursor:
;login text
; mov ebx,4 shl 16 + v_sp-64
mov ebx,[.old_xy]
sub ebx,3 shl 16 + 2
mov ecx,[sys_colors+4*5]
mov edx,curs
mov esi,1
mov eax,4
int 0x40
add ebx,4
int 0x40
mov ebx,[send_key_string.xy]
mov [.old_xy],ebx
sub ebx,3 shl 16 + 2
mov ecx,0xffffff;[sys_colors+4*8]
int 0x40
add ebx,4
int 0x40
ret
.old_xy dd 7 shl 16 + v_sp-62
curs db '|'
show_string:
mov ebx,7 shl 16 + v_sp-62
mov ecx,[sys_colors+4*8]
mov edx,in_text
mov esi,41
mov eax,4
int 0x40
add ebx,2 shl 16 + 9
add edx,41
int 0x40
add ebx,9
add edx,41
int 0x40
call show_cursor
ret
view_text db 16,'?',16
in_text: times 255 db 0
;E:.
;B+ Friends...
add_friend:
;ebx - begin
; [ebx]=1 - Group name
; [ebx]=2 - Active user
; [ebx]=other - Non active user
;ecx - length
cmp [last_friend_line],fr_max_lines-1
je .no_more
test ecx,not 31
jnz .no_more ; very long id name
inc [last_friend_line]
mov esi,ebx
mov edi,[last_friend_place]
inc ecx
add [last_friend_place],ecx
dec ecx
cld
rep movsb
mov al,0
stosb
stosb
.no_more:
ret
last_friend_place dd fr_e ;del
;last_friend_place dd friend_zone ;uncom
find_friend:
push ebx ecx
mov edx,friend_zone
mov esi,0
mov edi,[last_friend_line]
; inc edi ;? uncom ?
.next_name:
cmp [edx],byte 1
je .no_find ;Group
inc edx
dec ecx
.next:
mov al,[edx]
mov ah,[ebx]
cmp ah,al
jne .no_find
inc edx
inc ebx
dec ecx
jne .next
cmp [edx],byte 0
jne .no_find
;find
mov eax,esi
cmp esi,9
ja .letter
add al,'0'
ret
.letter:
add al,'A'-10
ret
.no_find:
cmp [edx],byte 0
je .go_next
inc edx
jmp .no_find
.go_next:
dec edi
je .noting
mov ebx,[esp+4]
mov ecx,[esp]
inc esi
jmp .next_name
.noting:
mov al,'!'
pop ecx ebx
ret
;E:.
;B+ Connect / Disconnect
yahoo_c:
call connect
cmp eax,0
jne still ;not connected
mov [is_connect],0x1
jmp still
yahoo_d:
cmp [is_connect],0x0
je .noting
call disconnect
;
;stop connection
mov [is_connect],0x0
;
;clear text
mov ah,27
call send_key_string
;
;clear friends
; mov [last_friend_line],0x0 ;uncom
; mov [last_friend_place],friend_zone ;uncom
;
;set dafaut friend
mov [f_name_b],fnb
mov [f_name_l],10
mov [view_text+1],'?'
call draw_window
.noting:
jmp still
is_connect dd 0x0
;E:.
;B+ Load username / password
input_username:
mov edi,username
mov [edi],byte '_'
inc edi
mov ecx,16-1
cld
rep stosb
mov [.unp],username
.next:
call show_username
;get enen
mov eax,10
int 0x40
cmp eax,1
je .end
cmp eax,3
je .end
;key
mov eax,2
int 0x40
cmp ah,13
je .end
cmp ah,8
jne .no_back
cmp [.unp],username
je .next
dec [.unp]
mov ebx,[.unp]
mov [ebx],byte '_'
mov [ebx+1],byte 0
jmp .next
.no_back:
cmp [.unp],username+16
je .next
cmp ah,'0'
jb .bad
mov ebx,[.unp]
mov [ebx],ah
mov [ebx+1],byte '_'
inc [.unp]
.bad:
jmp .next
.end:
;del cursor
mov ebx,[.unp]
mov [ebx],byte 0
call show_username
;clear password
mov [password],byte 0
;hide password
mov ebx,(2+41*6) shl 16 + v_sp-15-15
mov ecx,[sys_colors+4*5]
mov edx,f_password
mov esi,4
mov eax,4
int 0x40
jmp still
.unp dd username
show_username:
;hide
mov ebx,(4+12*6-1) shl 16 + 16*6+1
mov ecx,(v_sp-15-15) shl 16 + 9
mov edx,[sys_colors+4*5]
mov eax,13
int 0x40
;show
mov ebx,(4+12*6) shl 16 + v_sp-15-15
mov ecx,[sys_colors+4*8]
mov edx,username
mov esi,16
mov eax,4
int 0x40
ret
username: times (16+1) db 0
input_password:
;clear
mov edi,password
mov ecx,24
mov al,0
cld
rep stosb
mov [.unp],password
;hide password
mov ebx,(2+41*6) shl 16 + v_sp-15-15
mov ecx,[sys_colors+4*5]
mov edx,f_password
mov esi,4
mov eax,4
int 0x40
.next:
;get enen
mov eax,10
int 0x40
cmp eax,1
je still
cmp eax,3
je still
;key
mov eax,2
int 0x40
cmp [.unp],password+24
je .no_next
cmp ah,13
jne .no_still
.no_next:
call show_password
jmp still
.no_still:
mov ebx,[.unp]
mov [ebx],ah
inc [.unp]
jmp .next
.unp dd password
show_password:
cmp [password],byte 0
je .end
mov ebx,(2+41*6) shl 16 + v_sp-15-15
mov ecx,[sys_colors+4*8]
mov edx,f_password
mov esi,4
mov eax,4
int 0x40
.end:
ret
f_password db '####'
password: times (24+1) db 0
;E:.
;B+ INTERNET
;Functions:
;call add_friend
; ebx+1 - pointer to name
; [ebx]=1 - Group name
; [ebx]=2 - Active user
; [ebx]=other - Non active user
; ecx - length
;
;call show_message
; ebx - begin of string
; ecx - length
; -----
; NOTE Use format:
; (<char>) <message>
; where:
; <char> - friend user char
; <message> - message from friend
;
;call find_friend
; ebx - begin of name
; ecx - length
; ret:
; al - friend user char
; -----
; NOTE currenly don't show message if al='!'
;Variables
;usernave (zero terminated)
;password (zero terminated)
;f_name_b - current friend user (to send)
;f_name_l - ^ length
;Memory
; (friend_zone+32*fr_max_lines) < addr: [addr] - free
connect:
;conect to yahoo
;return 0 if OK
;return <>0 if some other event (sys.func.23)
mov eax,0
ret
disconnect:
;disconnect
ret
check_message:
;test receive messages
ret
;E:.
;B+ Test data ;del
friend_zone: ;del
db 1,'First:',0 ;del
db 2,'hahaha',0 ;del
db 3,'second',0 ;del
db 3,'menuetos',0 ;del
db 1,'Treti:',0 ;del
db 2,'fourth',0 ;del
fr_e db 0 ;del
;del
times 200 db 0 ;del
;del
last_friend_line dd 0x6 ;del
;E:. ;del
;B+ Data area
;caption db 'Yahoo Messanger for MenuetOS'
caption db 'Messinger (Yahoo Compatible)'
caption_end:
;User / Password
login_txt db 'STATUS: SESSION: ___.___.___.___'
;VISIBLE
;HIDDEN
login_txt_end:
user_txt db 'USER ID ->'
user_txt_end:
psw_txt db 'PASSWORD ->'
psw_txt_end:
con_txt db 'CONNECT'
con_txt_end:
dis_txt db 'DISCONNECT'
dis_txt_end:
;E:.
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property