/programs/system/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/system/board/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm board.asm board |
@pause |
/programs/system/board/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm board.asm board |
@pause |
/programs/system/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/system/calendar/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm calendar.asm calendar |
@pause |
/programs/system/calendar/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm calendar.asm calendar |
@pause |
/programs/system/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 |