Add some more sources from MENUET32

git-svn-id: svn://kolibrios.org@3497 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Yogev Ezra 2013-05-09 18:49:02 +00:00
parent f7a17ff6c5
commit de447bcec4
6 changed files with 806 additions and 0 deletions

View File

@ -0,0 +1,5 @@
ver
echo Type 'help' for help. Type '/example' for additional information (RUS)
echo
ends

View File

@ -0,0 +1,35 @@
cls
echo
echo <20>â® ¯à®á⥩訩 ¯à¨¬¥à ¨á¯®«­ï¥¬®£® áªà¨¯â  ¤«ï ¨­â¥à¯à¥â â®à  ª®¬ ­¤­®©
echo áâப¨ CMD ¢¥àᨨ 0.24
echo ˆá¯®«ì§ã©â¥ ª®¬ ­¤ë echo ¨ pause ¤«ï ¢ë¢®¤  ⥪áâ  ¨ ¢®§¬®¦­®áâ¨
echo ¢§ ¨¬®¤¥©á⢨ï á ¯®«ì§®¢ â¥«¥¬.
echo á¢ï§¨ á ­¥¤®áâ â®ç­®© ¤®à ¡®âª®© ¨­â¥à¯à¥â â®à  ¨ ¬¥å ­¨§¬  ¨á¯®«­¥­¨ï
echo áªà¨¯â®¢ ¦¥« â¥«ì­® ᮧ¤ ¢ âì áªà¨¯âë ⮫쪮 ¢ TINYPAD'e ¨ ­¥ ¨§¬¥­ïâì 㦥
echo á®åà ­ñ­­ë© ­  à ¬¤¨áª ä ©«, ¯à¨í⮬ ­¥ ®áâ ¢«ïâì ¯®á«¥ ª®¬ ­¤ ­¥­ã¦­ëå
echo ᨬ¢®«®¢ (­ ¯à¨¬¥à, ¯à®¡¥«ë).
echo
echo <20>ਬ¥à ¢ë¯®«­¥­¨ï ¯à®á⥩襩 ¯à ªâ¨ç¥áª®© § ¤ ç¨ á ¯®¬®éìî ¨á¯®«­ï¥¬ëå
echo áªà¨¯â®¢:
echo
echo <20> ¦¬¨â¥ «î¡ãî ª« ¢¨èã ¤«ï ⮣®, ç⮡ë ᮧ¤ âì § ¯ á­ãî ª®¯¨î ä ©«  CMD.ASM
pause
cp cmd.asm+cmd.bak
echo
echo ’¥¯¥àì ­ ¦¬¨â¥ «î¡ãî ª« ¢¨èã ¤«ï ⮣®, çâ®¡ë ¢ë¢¥á⨠¨¬ï ⮫쪮 çâ®
echo ᮧ¤ ­­®£® ä ©«  ­  íªà ­ ¨ 㤮á⮢¥à¨âìáï ¢ ¥£® ¯à¨áãâá⢨¨ ­  /RD/1
pause
ls cmd.bak
echo
echo ’¥¯¥àì ­ ¦¬¨â¥ «î¡ãî ª« ¢¨èã ¤«ï ⮣®, ç⮡ë 㤠«¨âì ⮫쪮 ç⮠ᮧ¤ ­­ë©
echo ä ©« CMD.BAK á à ¬¤¨áª .
pause
del cmd.bak
echo
echo <20>ਠ¢ë§®¢¥ ª®¬ ­¤ë PAUSE ¢ë ¬®¦¥â¥ ­ ¦ âì ª« ¢¨èã ESCAPE, çâ®¡ë ¯à¥à¢ âì
echo à ¡®âã áªà¨¯â . ‚믮«­¥­¨¥ ¢­¥è­¨å ª®¬ ­¤ ¢ ¤ ­­®© ¢¥àᨨ 㦥 ॠ«¨§®¢ ­®.
echo ˆá¯®«ì§®¢ ­¨¥ ᨬ¢®«  '/' ¢ áªà¨¯â å ­¥ ॠ«¨§®¢ ­®. ¤ ­­®© ¢¥àᨨ
echo ª®¬ ­¤­ë¥ áªà¨¯âë ४®¬¥­¤ã¥âáï § ¢¥àè âì ª®¬ ­¤®© ends.
echo †¤¨â¥ ®¡­®¢«¥­¨©.
echo
ends

View File

@ -0,0 +1,70 @@
; 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 "CMDIPC.INC" ; <20>®¤ª«îç¨âì ä ©« 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 ; <20>யãáâ¨âì áâபã
mov eax,16
mov ebx,text4
call print
call eol ; <20>யãáâ¨âì áâபã
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:

View File

@ -0,0 +1,55 @@
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x100000
dd 0x7fff0
dd I_PARAM ; 㪠§ â¥«ì ­  ¯ à ¬¥âàë
include "CMDIPC.INC" ; <20>®¤ª«îç¨âì ä ©« 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:

View File

@ -0,0 +1,365 @@
;*********************************
;* *
;* PAINT 0.02 ¤«ï MenuetOS *
;* *
;* Š®¬¯¨«¨à®¢ âì FASM'®¬ *
;* *
;*********************************
;******************************************************************************
; <20>â㠯ணࠬ¬ã ­¥ ­ã¦­® á¥à쥧­® à áᬠâਢ âì - íâ® ¢á¥£® «¨èì ¯à¨¬¥à,
; ¢ ª®â®à®¬ ¯®ª § ­®, ª ª à ¡®â âì á ­¥ª®â®à묨 á¨á⥬­ë¬¨ äã­ªæ¨ï¬¨ Œ¥Ž‘,
; ­® ­¨ª ª ­¥ ­®à¬ «ì­ë© £à ä¨ç¥áª¨© । ªâ®à. Š®¤ ¯à®£à ¬¬ë Ž—…<E28094>œ ¯à®á⮩,
; ¨ ®­  ¯à¥¤­ §­ ç¥­  ¤«ï â¥å, ªâ® ⮫쪮 ­ ç¨­ ¥â ¨§ãç âì  áᥬ¡«¥à,
; ¯®í⮬ã ï áâ६¨«áï ᤥ« âì ¥£® ª ª ¬®¦­® ¡®«¥¥ ¯®­ïâ­ë¬.
; ’¥¬ ­¥ ¬¥­¥¥, ª®¤ ¤®¢®«ì­® ­¥¯«®å® ®¯â¨¬¨§¨à®¢ ­, å®âï íâ® ­¥¬­®£®
; ¬®¦¥â § âà㤭¨âì ¥£® ¯®­¨¬ ­¨¥. Ÿ ¯®áâ à «áï âé â¥«ì­® ¯à®ª®¬¬¥­â¨à®¢ âì
; á«®¦­ë¥ ¬¥áâ . Šáâ â¨, ¨¤¥ï ¯à®£à ¬¬ë ¯à¨­ ¤«¥¦¨â ­¥ ¬­¥,   Sniper'ã, ¤«ï
; ª®â®à®£® ¢®¡é¥¬-â® ¢á¥ ¨ ¯¨á «®áì.
; “¤ ç¨ ¢ ¨§ã祭¨¨  á¬ !
; ˆ¢ ­ <20>®¤¤ã¡­ë©, ivan-yar@bk.ru
;******************************************************************************
; <20>®¤ª«îç ¥¬ ­¥®¡å®¤¨¬ë¥ ¬ ªà®áë
include 'macros.inc'
;******************************************************************************
; <20>€—€Ž <20><>Žƒ<C5BD>€ŒŒ
meos_app_start
; Ž<>œ ŠŽ„€
code
mov eax,40 ; á®®¡é¨¬ á¨á⥬¥, ª ª¨¥ ᮡëâ¨ï ¡ã¤¥¬ ®¡à ¡ â뢠âì
mov ebx,0100101b ; ¬ áª  ᮡë⨩ - ¯¥à¥à¨á®¢ª  (1) + ª­®¯ª  (3) + ¬ëèì (6
int 0x40 ; íâ  ª®¬ ­¤  ¢ë§ë¢ ¥â á¨á⥬­ãî äã­ªæ¨î
mov [workarea.cx],10 ; ª®®à¤¨­ âë à ¡®ç¥© (ª«¨¥­â᪮©) ®¡« áâ¨
mov [workarea.cy],45 ; ¤«ï à¨á®¢ ­¨ï
red:
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª­ 
still: ; ƒ<E282AC>‰ –ˆŠ‹ <20><>Žƒ<C5BD>€ŒŒ - –ˆŠ‹ Ž<><C5BD><EFBFBD>ŽŠˆ ŽŽ<C5BD>™…<E284A2>ˆ
mov eax,10 ; äã­ªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï; ¯à®£à ¬¬  ®áâ ­ ¢«¨¢ ¥âáï ­ 
int 0x40 ; á«¥¤ãîé ï ª®¬ ­¤  ­¥ ¡ã¤¥â ¢ë¯®«­¥­  ¤® â¥å ¯®à, ¯®ª 
; ­¥ ¯à®¨§®©¤ñâ ᮡë⨥
; ⥯¥àì ॣ¨áâà eax ᮤ¥à¦¨â ­®¬¥à ᮡëâ¨ï
; ¯®®ç¥à¥¤­® áà ¢­¨¬ ¥£® á® ¢á¥¬¨ ¢®§¬®¦­ë¬¨ §­ ç¥­¨ï¬¨, çâ®¡ë ¢ë§¢ âì
; ­ã¦­ë© ®¡à ¡®â稪
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª­® ?
je red ; ¥á«¨ ॣ¨áâà eax à ¢¥­ ¥¤¨­¨æ¥, â® ¯¥à¥å®¤¨¬ ­  ¬¥âªã red
cmp eax,3 ; ­ ¦ â  ª­®¯ª  ?
je button
cmp eax,6 ; ¬ëèì?
je mouse
jmp still ; ¥á«¨ ¯à®¨§®è«® ᮡë⨥, ª®â®à®¥ ¬ë ­¥ ®¡à ¡ â뢠¥¬,
; ¯à®áâ® ¢®§¢à é ¥¬áï ª ­ ç «ã 横« , å®âï â ª®£® ¡ëâì
; ­¥ ¤®«¦­®! .¥. ¥á«¨ íâã ª®¬ ­¤ã ®âá ã¡à âì, â®
; ­¨ç¥£® áâà è­®£® ­¥ á«ãç¨âáï.
;******************************************************************************
button: ; ®¡à ¡®â稪 ­ ¦ â¨ï ª­®¯ª¨ ¢ ®ª­¥ ¯à®£à ¬¬ë
mov eax,17 ; äã­ªæ¨ï N17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
int 0x40
; ⥯¥àì ¢ ॣ¨áâॠah ᮤ¥à¦¨âáï ¨¤¥­â¨ä¨ª â®à.
shr eax,8 ; ah -> al (ᤢ¨£ ­  8 ¡¨â ¢¯à ¢®)
dec al ; ¨¤¥­â¨ä¨ª â®à_ª­®¯ª¨--;
jnz .noclose ; ¥á«¨ १ã«ìâ â ¯à¥¤ë¤ã饩 ª®¬ ­¤ë à ¢¥­ ­ã«î, § ªà뢠¥¬áï
; ¨­ ç¥ - ¨¤ñ¬ ­  ¬¥âªã noclose
or eax,-1 ; ¢ë室 ¨§ ¯à®£à ¬¬ë
int 0x40
.noclose:
; ¥á«¨ ¬ë á ¯®¯ «¨, §­ ç¨â ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨ ­¥ ¡ë« à ¢¥­ ­ã«î...
; ⥯¥àì ã ­ á ¢ eax ᮤ¥à¦¨âáï (­®¬¥à 梥⭮© ª­®¯ª¨ - 1),
; â.¥ ¨«¨ 1, ¨«¨ 2, ... ,¨«¨ 5
; 㬥­ì訬 ­  1:
dec eax
; ¢®â íâ  ¢®â ª®¬ ­¤  ¨§¢«¥ª ¥â ¢ eax ¤¢®©­®¥ á«®¢® ¯®  ¤à¥áã colors+eax*4
; £¤¥ colors - ᬥ饭¨¥ ¬¥âª¨ colors, ¯®á«¥ ª®â®à®© ¨¤¥â ¯®á«¥¤®¢ â¥«ì­®áâì
; 梥⮢, eax*4 - ­®¬¥à 梥â , 㬭®¦¥­­ë© ­  4, â.ª. ­  ®¤¨­ 梥⠭㦭®
; ç¥âëॠ¡ ©â .
mov eax,[colors+eax*4]
; ⥯¥àì ¬ë ãáâ ­®¢¨¬ 梥â, ᮤ¥à¦ é¨©áï ¢ ॣ¨áâॠeax ª ª ®á­®¢­®©:
mov [active_color],eax
; ­ã ¢®â, ᮡá⢥­­®, ¨ ¢áñ, çâ® ®â ­ á âॡ®¢ «®áì ;)
; ¢¥à­ñ¬áï ª ­ ç «ã 横«  ®¡à ¡®âª¨ ᮡë⨩
jmp still
;******************************************************************************
mouse: ; ®¡à ¡®â稪 ¬ëè¨
mov eax,37 ; á­ ç «  ¯®«ã稬 ⥪ã騥 ª®®à¤¨­ âë ¬ëè¨
mov ebx,1
int 0x40
mov ebx,eax ; ¯à¥®¡à §ã¥¬ ¨å
shr eax,16 ; eax=x;
and ebx,0xffff ; ebx=y;
cmp ebx,22
jb save_canvas
sub eax,[workarea.cx] ; x-=[workarea.cx]
cmp eax,0 ; ¥á«¨ ¬ëèì «¥¢¥¥ ª«¨¥­â᪮© ®¡« áâ¨,
jle .not_pressed ; ­¨ç¥£® ­¥ à¨á㥬
cmp eax,[workarea.sx] ; ¥á«¨ ¬ëèì ¯à ¢¥¥...
jae .not_pressed
sub ebx,[workarea.cy]
cmp ebx,0 ; ...¢ëè¥...
jle .not_pressed
cmp ebx,[workarea.sy] ; ...­¨¦¥...
jae .not_pressed
; ª ª¨¥ ª­®¯ª¨ ­ ¦ âë?
mov eax,37
mov ebx,2
int 0x40
; ¥á«¨ «¥¢ ï ª­®¯ª  (â.¥. eax = 1), ⥠¯®©¤ñ¬ ¤ «ìè¥
cmp eax,1
je .leftbtn
.not_pressed:
; ‹¥¢ ï ª­®¯ª  ­¥ ­ ¦ â , § ¯®¬­¨¬ ⥪ã騥 ª®®à¤¨­ âë ¨ ¡ã¤¥¬ ¦¤ âì ᮡëâ¨ï
mov [mouse_pressed],0 ; ¬ëèì ­¥ ­ ¦ â 
mov eax,37 ; ¯®«ã稬 ª®®à¤¨­ âë
mov ebx,1
int 0x40
mov ebx,eax
shr eax,16
and ebx,0xffff
mov [old_x],eax ; § ¯®¬­¨¬ ¨å
mov [old_y],ebx
jmp still
.leftbtn:
; ‹¥¢ ï ª­®¯ª  ­ ¦ â , ­ ¤® íâ® § ¯¨á âì!
mov [mouse_pressed],1
; <20>®«ã稬 ª®®à¤¨­ âë ªãàá®à  ¬ëè¨ (®â­®á¨â¥«ì­® ®ª­ )
mov eax,37 ; äã­ªæ¨ï 37 - ¯®«ãç¨âì á®áâ®ï­¨¥ ¬ëè¨
mov ebx,1 ; ¯®¤äã­ªæ¨ï 1
int 0x40
; <20>¥à¥¤¥« ¥¬ ¨å â ª, çâ®¡ë ®­¨ ¡ë«¨ ¢ à §­ëå ॣ¨áâà å, â.¥. eax ¨ ebx
mov ebx,eax
shr eax,16
and ebx,0xffff
; <20>®¤£®â®¢¨¬ ¯ à ¬¥âàë ¤«ï ä㭪樨 à¨á®¢ ­¨ï «¨­¨¨
mov ecx,[old_x] ; ¤«ï ­ ç «  § £à㧨¬ áâ àë¥ ª®®à¤¨­ âë
mov edx,[old_y]
mov [old_x],eax ; ⥯¥àì á®åà ­¨¬ ⥪ã騥 ¢ áâ àë¥
mov [old_y],ebx
shl ecx,16 ; ¢ ¢¥àå­¥¥ á«®¢® ­ ç «ì­ë¥ (⥪ã騥) ª®®à¤¨­ âë
shl edx,16
add eax,ecx ;   ¢ ­¨¦­¥¥ á«®¢® ª®­¥ç­ë¥, â.¥. áâ àë¥
add ebx,edx
mov ecx,ebx ; ¯®¬¥­ï¥¬ ॣ¨áâàë â ª, ª ª íâ㠭㦭® 38 ä㭪樨
mov ebx,eax
mov eax,38 ; ­®¬¥à ä㭪樨 ¢ eax
mov edx,[active_color] ; ¢ edx 梥â
int 0x40
;  - ¯®¯à®¡ã©â¥ ¯®áâ ¢¨âì ¤à㣨¥ §­ ç¥­¨ï (00090001)
mov edi,0x00010001 ; çâ®¡ë «¨­¨ï ­¥ ¡ë«  ᫨誮¬ â®­ª®©,
add ebx,edi ; ­ à¨á㥬 à冷¬ ¥é¥ 3!
int 0x40
add ecx,edi
int 0x40
sub ebx,edi
int 0x40
sub ebx,edi ; ­ã   ç⮡ë ᬮâ५®áì ᮢᥬ ªàãâ®,
int 0x40 ; ¤®à¨á㥬 ¥é¥ 5!
sub ecx,edi
int 0x40
sub ecx,edi
int 0x40
add ebx,edi
int 0x40
add ebx,edi
int 0x40
jmp still
;******************************************************************************
save_canvas:
mov eax,[process.x_size]
add eax,[workarea.cx]
mov ebx,[process.y_size]
add ebx,[workarea.cy]
jmp still
;******************************************************************************
; *********************************************
; ******* Ž<><C5BD>…„…<E280B9>ˆˆ Ž<C5BD>ˆŽŠ€ ŽŠ<C5BD>€ *******
; *********************************************
draw_window:
mov eax,48 ; <20>Ž„ƒ<E2809E>“†€…Œ ˆ…Œ<E280A6>… –‚…’€
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
mov eax,12 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
mov ebx,1 ; 1, ­ ç¨­ ¥¬ à¨á®¢ âì
int 0x40
; ‘Ž‡„€ðŒ ŽŠ<C5BD>Ž
mov eax,0 ; äã­ªæ¨ï 0 : ®¯à¥¤¥«¨âì ¨ ®âà¨á®¢ âì ®ª­®
mov ebx,100*65536+400 ; [x áâ àâ] *65536 + [x à §¬¥à]
mov ecx,100*65536+300 ; [y áâ àâ] *65536 + [y à §¬¥à]
mov edx,[sc.work] ; 梥â à ¡®ç¥© ®¡« á⨠RRGGBB,8->color gl
or edx,0x02000000
mov esi,[sc.grab] ; 梥⠯®«®áë § £®«®¢ª  RRGGBB,8->color gl
or esi,0x80000000
mov edi,[sc.frame] ; 梥â à ¬ª¨ RRGGBB
int 0x40
mov eax,9 ; ¯®«ã稬 ¨­ä®à¬ æ¨î ® ᥡ¥
mov ebx,process
mov ecx,-1
int 0x40
mov eax,[process.x_size] ; ­ áâந¬ à §¬¥à à ¡®ç¥© ®¡« áâ¨
add eax,-20 ; (å à §¬¥à ®ª­  - 20)
mov [workarea.sx],eax ;
mov eax,[process.y_size] ;
add eax,-60 ; (ã à §¬¥à - 60)
mov [workarea.sy],eax ;
; ‡€ƒŽ‹Ž‚ŽŠ ŽŠ<C5BD>
mov eax,4 ; äã­ªæ¨ï 4 : ­ ¯¨á âì ¢ ®ª­¥ ⥪áâ
mov ebx,8*65536+8 ; [x] *65536 + [y]
mov ecx,[sc.grab_text] ; 梥â
or ecx,0x10000000 ; èà¨äâ
mov edx,header ;  ¤à¥á áâப¨
mov esi,header_len ; ¨ ¥ñ ¤«¨­ 
int 0x40
; Š<>Ž<EFBFBD>Š€ ‡€Š<E282AC>ˆŸ ŽŠ<C5BD>
mov eax,8 ; äã­ªæ¨ï 8 : ®¯à¥¤¥«¨âì ¨ ­ à¨á®¢ âì ª­®¯ªã
; mov ebx,(300-19)*65536+12 ; [x áâ àâ] *65536 + [x à §¬¥à]
mov ebx,[process.x_size]
add ebx,-19
shl ebx,16
add ebx,12
mov ecx,5*65536+12 ; [y áâ àâ] *65536 + [y à §¬¥à]
mov edx,1 ; ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨
mov esi,[sc.grab_button] ; 梥⠪­®¯ª¨ RRGGBB
int 0x40
cmp [process.y_size],80
jb .finish
; ᮧ¤ ñ¬ ª­®¯ª¨ ¢ë¡®à  梥â :
mov ebx,10*65536+10 ; ­ ç «ì­ ï x ª®®à¤¨­ â  ¨ à §¬¥à
mov ecx,27*65536+10 ; ­ ç «ì­ ï y ª®®à¤¨­ â  & size
.new_button:
inc edx ; ¨¤¥­â¨ä¨ª â®à++;
mov esi,[btn_colors-8+edx*4] ; 梥⠪­®¯ª¨
int 0x40 ; áâ ¢¨¬ ª­®¯ªã
add ebx,12*65536 ; á«¥¤ãîé ï ª­®¯ª  ¯à ¢¥¥ ­  12
cmp edx,9 ; áà ¢­¨¢ ¥¬ edx (¨¤¥­â¨ä¨ª â®à) á 9
jbe .new_button ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­® -> ¥éñ ®¤­ã ª¯®ªã
mov eax,13 ; ç¨á⨬ "宫áâ" - ª«¨¥­âáªãî ®¡« áâì
mov ebx,[workarea.cx]
mov ecx,[workarea.cy]
shl ebx,16
shl ecx,16
add ebx,[workarea.sx]
add ecx,[workarea.sy]
mov edx,0xffffff
int 0x40
.finish:
mov eax,12 ; á®®¡é ¥¬ á¨á⥬¥ ® § ¢¥à襭¨¨ ®âà¨á®¢ª¨ ®ª­ 
mov ebx,2
int 0x40
ret
;******************************************************************************
; ­ ç «® ®¡« á⨠¨­¨æ¨ «¨§¨à®¢ ­­ëå ¤ ­­ëå
; ¥á«¨ ªâ® ¥éñ ­¥ §­ ¥â, çâ® §­ ç¨â "¨­¨æ¨ «¨§¨à®¢ ­­ë¥", â® ¯®ïá­ïî:
; í⮠⥠¤ ­­ë¥, ª®â®àë¬ ¯à¨á¢®¥­® ­ ç «ì­®¥ §­ ç¥­¨¥
data
header: ; áâப  § £®«®¢ª 
db 'PAINT v0.2 for MenuetOS'
header_len = $ - header ; ¨ ¥ñ ¤«¨­ 
mouse_pressed db 0 ; ¯®ª §ë¢ ¥â, ­ ¦ â  «¨ ¡ë«  ¬ëèì ¢ ¯à¥¤ë¤ã騩 ¬®¬¥­â
; æ¢¥â  ª­®¯®ª
btn_colors:
dd 0xdddddd ; white
dd 0x444444 ; black
dd 0x00dd00 ; green
dd 0x0000dd ; blue
dd 0xdd0000 ; red
dd 0xdd00dd ; magenta
dd 0xdddd00 ; yellow
dd 0x00dddd ; cyan
dd 0x559955 ; warm green
; æ¢¥â  ª¨á⨠(¢ ⮬ ¦¥ ¯®à浪¥, çâ® ¨ æ¢¥â  ª­®¯®ª)
colors:
dd 0xffffff ; ¡¥«ë©
dd 0x000000 ; ç¥à­ë©
dd 0x00ff00 ; §¥«¥­ë©
dd 0x0000ff ; ᨭ¨©
dd 0xff0000 ; ªà á­ë©
dd 0xff00ff ; ¯ãà¯ãà­ë©
dd 0xffff00 ; ¦¥«âë©
dd 0x00ffff ; £®«ã¡®©
dd 0x77bb77 ; ⥯«ë© §¥«¥­ë©
;******************************************************************************
;   ¢®â âãâ ­ ç¨­ ¥âáï ®¡« áâì <20>…¨­¨æ¨ «¨§¨à®¢ ­­ëå ¤ ­­ëå, â.¥.
; §¤¥áì ¤ ­­ë¬ §­ ç¥­¨ï ­¥ ¯à¨á¢®¥­ë. ®â«¨ç¨¥ ®â ¨­¨æ., ­¥ 㢥«¨ç¨¢ îâ à §¬¥à
; ä ©« 
udata
active_color dd ? ;  ªâ¨¢­ë© 梥â
old_x dd ? ; áâ àë¥ ª®®à¤¨­ âë ¬ëè¨
old_y dd ?
workarea: ; ª®®à¤¨­ âë ¨ à §¬¥àë ª«¨¥­â᪮© ®¡« áâ¨
.cx dd ? ; c - ª®®¤¨­ âë
.cy dd ?
.sx dd ? ; s - à §¬¥àë
.sy dd ?
sc system_colors ; á¨á⥬­ë¥ 梥â 
process process_information ; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áá¥
restflag dd ?
canvas rb 800*600*3
meos_app_end

View File

@ -0,0 +1,276 @@
; Programa Mostra memoria
; Projeto: Clovis Bombardelli e Felipe Gustavo Bombardelli
; Usar Fasm Assembler
; Dez/2007
; Infos:
; keys: w - add 0x200 to current memory address
; s - sub 0x200
; e - add 0x10
; d - sub 0x10
;
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 I_END+STACK_SIZE ; memory for app
dd I_END+STACK_SIZE ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
START:
main:
call monta_quadro
.a: mov eax, 11 ; espera por evento
int 0x40 ; 0= -> redraw
or al,al
jz .h
cmp al, 2 ; 1= -> REDRAW
jb main ; 2= -> tecla pressionada
jz .c ; 3= -> botão pressionado
; botão
mov eax,17 ;
int 0x40 ; OBSERVAÇÕES
cmp ah,1 ; se o botão apertado for fechar, minimizar, maximizar...todos devem ser do sistema
jnz .b ; mover...etc
or eax,-1 ; saida do aplicativo **************************deve ser do sistema
int 0x40 ; nunca do aplicativo
.b: jmp .a ; loop para novo evento
; tecla
.c: mov eax,2 ; getkey
int 0x40
;cmp al, 1
;jnz .a
cmp ah, 'w'
jne .a1
add [end_base], 0x200
jmp main ;
.a1: cmp ah, 's'
jne .a2
cmp [end_base], dword 0x80000000
jbe .a2
sub [end_base], 0x200
jmp main ;
.a2: cmp ah, 'e'
jne .a3
add [end_base], 0x10
jmp main ;
.a3: cmp ah, 'd'
jne .b1
cmp [end_base], dword 0x80000000
jbe .b1
sub [end_base], 0x10
.b1: jmp main
; atualiza apenas o codigo hex / ascii
.h:
call hex_loop
; inc [contador] ; usado apenas para testar a dinamica
jmp .a ; retorna para buscar novo evento
monta_quadro:
; posição inicial, subfunção 1
mov eax,12
mov ebx,1
int 0x40
; Desenha o quadro
mov eax,0 ; função 0 : define e monta o quadro
mov ebx,100*65536+480 ; [x pos] *65536 + [x lar]
mov ecx,100*65536+440 ; [y pos] *65536 + [y alt]
mov edx,[cor_janela] ; cor area RRGGBB
mov edi,titulo ; Titulo
int 0x40
; escreve texto no quadro (barra superior)
mov edi,[cor_janela]
mov eax,4
mov ecx, [cor_texto]
mov ebx,8*65536+8
mov edx,teste
int 0x40
add ebx,11 ; adiciona espaço na coord y
mov eax,4
mov ecx, [cor_texto]
mov edx,barra1
int 0x40
call hex_loop
; posição final, subfunção 2
.d: mov eax,12
mov ebx,2
int 0x40
ret
; buscar conteudo da memoria para mostrar
hex_loop:
xor eax, eax
mov ebx, [end_base] ; endereço base
; imprime o endereço
mov edx, 8*65536+40 ; posição inicial hex
mov [pos_ascii], edx
add [pos_ascii], 360*65536 ; posição inicial ascii
mov word [pos_x], 0
mov al, [quant_linhas]
mov edi,[cor_janela]
.c: push eax ;
push edx ;
push ebx ; salva endereço base
mov al, 47
mov ecx, ebx ; imprime o endereço
mov ebx, 0x00080100
mov esi, [cor_endereco]
int 0x40
pop ebx ;
add edx, 60*65536 ; pula 8 espaços mais alguma coisa
; busca hexcode
mov esi, [cor_hexcode]
mov al, 4
.b: push eax ; ----------------------------------------------------------ok
mov al, 72 ; ebx= endereço de leitura (nao funcionou...) change this service to another
int 0x40 ; retorna ecx= dword da posição ebx
push ebx ; ----------------------------------------------------------ok
mov ebx, 0x00020100 ; 2 digitos, modo hex
mov al, 4
.a: push eax ; controle -------------------------------------------------ok
push ecx ; codigo
push edx ; posição
and ecx, 0xff
mov al, 47
int 0x40
call imprime_car$
pop edx ;
pop ecx ;
shr ecx, 8
add edx, (18)*65536
pop eax ; ----------------------------------------------------------ok
dec al
jnz .a
pop ebx ; ----------------------------------------------------------ok
add ebx, 4 ; soma 4 ao endereço base
pop eax ; ----------------------------------------------------------ok
dec al ; imprimir mais 4 vezes incrementando ebx em 4
jnz .b
pop edx ;
add edx, 10 ;
; imprime a string ascii
push ebx
push edx
mov al, 4
mov ebx, [pos_ascii] ; endereço na tela
mov edx, ascii_string ; endereço da string
or ecx, [cor_ascii] ; cor
int 0x40
mov [ascii_x], byte 0
add [pos_ascii], 10
pop edx
pop ebx
pop eax ;
dec al
jnz .c
ret
imprime_car$: ; ecx tem o caractere a imprimir
push ebx
xor ebx, ebx
mov bl, [ascii_x]
or cl, cl
jnz .c
mov cl, 0x20
.c: mov [ebx+ascii_string], cl
inc [ascii_x]
pop ebx
ret
; para acessar a memoria do sistema:
;
; acessar a base das tabelas de paginaçao
; com o endereço buscar o descritor de pagina
; ler o endereço físico ndo descritor
; ou buscar a pagina do sistema e ler nele o endereço fisico
; DATA AREA
align 0x10
;contador dd 0 ; para testar a dinamica
cor_janela dd 0x346f72c3 ; atrib, tipo, corRGB
cor_texto dd 0xc0fffffe ; fonte variavel, cor branca
cor_endereco dd 0xc0fffffc
cor_hexcode dd 0xc0fffffd
cor_ascii dd 0xc0fffffa
pos_x db 0
pos_y db 0
quant_linhas db 0x20
ascii_x db 0
end_base dd 0x80000000 ; ok
pos_ascii dd 0
ascii_string rb 0x11
reservado rb 3
titulo db 'Mostra a memoria do sistema operacional',0
teste db '-------- ------------------ Hex Code ------------------- -- A S C I I --',0
barra1 db 'Address: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 0123456789abcdef',0
align 0x10
I_END:
; service 72 from system calls
;
; must contain:
; mov eax, [eax]
; mov [esp+32], eax
; ret