mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-16 20:02:35 +03:00
e9922b1f71
git-svn-id: svn://kolibrios.org@6890 a494cfbc-eb01-0410-851d-a64ba20cac60
168 lines
5.9 KiB
NASM
168 lines
5.9 KiB
NASM
; <20>à®á⮩ ¯à¨¬¥à ¯à®£à ¬¬ë ¤«ï KolibriOS
|
||
; ®§¢ã稢 ¥â ª®¤ ¦ ⮩ ª« ¢¨è¨
|
||
;
|
||
; Š®¬¯¨«¨à®¢ âì FASM'®¬
|
||
; Œ®¦® ®âªàëâì example.asm ç¥à¥§ ¯à®£à ¬¬ã FASM (¥ñ ïà«ëª ¥áâì
|
||
; à ¡®ç¥¬ á⮫¥)
|
||
; € ¬®¦® ¯à®áâ® ¦ âì F9 ¢ Tinypad'¥. ‹®£ ª®¬¯¨«ï樨
|
||
; ®â®¡à ¦ ¥âáï ¤®áª¥ ®â« ¤ª¨ (¯à®£à ¬¬ BOARD)
|
||
;
|
||
; —â® ¢ ¦® § âì ¯à¨ ¯à®£à ¬¬¨à®¢ ¨¨ ¯®¤ Š®«¨¡à¨:
|
||
; <20>®¬¥à äãªæ¨¨ ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax.
|
||
; ‚맮¢ á¨á⥬®© äãªæ¨¨ ®áãé¥á⢫ï¥âáï ª®¬ ¤®© "int 0x40".
|
||
; ‚ᥠॣ¨áâàë, ªà®¬¥  㪠§ ëå ¢ ¢®§¢à é ¥¬®¬ § 票¨,
|
||
; ¢ª«îç ï ॣ¨áâà ä« £®¢ eflags, á®åà ïîâáï.
|
||
;
|
||
; <20>ਬ¥à:
|
||
; mov eax, 1 ;”ãªæ¨ï 1 - ¯®áâ ¢¨âì â®çªã ¢ ®ª¥
|
||
; ;ᯨ᮪ á¨áäãªæ¨© á¬. ¢ DOCPACK - sysfuncr.txt
|
||
; mov ebx, 10 ; ª®®à¤¨ â x=10
|
||
; mov ecx, 20 ; ª®®à¤¨ â y=10
|
||
; mov edx, 0xFFFfff ;梥â â®çª¨
|
||
; int 0x40 ;¢ë§¢ âì äãªæ¨î
|
||
;
|
||
; ’®¦¥ á ¬®¥ á ¨á¯®«ì§®¢ ¨¥¬ ¬ ªà®á :
|
||
; mcall 1, 10, 20, 0xFFFfff
|
||
;---------------------------------------------------------------------
|
||
|
||
use32 ; ¢ª«îç¨âì 32-¡¨âë© à¥¦¨¬ áᥬ¡«¥à
|
||
org 0 ; ¤à¥á æ¨ï á ã«ï
|
||
|
||
db 'MENUET01' ; 8-¡ ©âë© ¨¤¥â¨ä¨ª â®à MenuetOS
|
||
dd 1 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1)
|
||
dd START ; ¤à¥á ¯¥à¢®© ª®¬ ¤ë
|
||
dd I_END ; à §¬¥à ¯à®£à ¬¬ë
|
||
dd MEM ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
|
||
dd STACKTOP ; ¤à¥á ¢¥àè¨ë áâíª
|
||
dd 0 ; ¤à¥á ¡ãä¥à ¤«ï ¯ à ¬¥â஢
|
||
dd 0 ; § १¥à¢¨à®¢ ®
|
||
|
||
include "macros.inc" ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§ì áᥬ¡«¥à騪®¢!
|
||
|
||
;---------------------------------------------------------------------
|
||
;--- <20>€—€‹Ž <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||
;---------------------------------------------------------------------
|
||
|
||
START:
|
||
|
||
red: ; ¯¥à¥à¨á®¢ âì ®ª®
|
||
|
||
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª
|
||
|
||
;---------------------------------------------------------------------
|
||
;--- –ˆŠ‹ Ž<><C5BD>€<EFBFBD>Ž’Šˆ ‘Ž<E28098>›’ˆ‰ ----------------------------------------
|
||
;---------------------------------------------------------------------
|
||
|
||
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 ; ¥á«¨ <20>… ¦ â ª®¯ª á ®¬¥à®¬ 1,
|
||
jne still ; ¢¥àãâìáï
|
||
|
||
.exit:
|
||
mcall -1 ; ¨ ç¥ ª®¥æ ¯à®£à ¬¬ë
|
||
|
||
|
||
;---------------------------------------------------------------------
|
||
;--- Ž<><C5BD>…„…‹…<E280B9>ˆ… ˆ Ž’<C5BD>ˆ‘Ž‚Š€ ŽŠ<C5BD>€ ----------------------------------
|
||
;---------------------------------------------------------------------
|
||
|
||
draw_window:
|
||
|
||
mcall 12, 1 ; äãªæ¨ï 12: á®®¡é¨âì Ž‘ ® ç «¥ ®âà¨á®¢ª¨
|
||
|
||
mcall 48, 3, sc,sizeof.system_colors
|
||
|
||
; ¤ «¥¥: á ç « ¤«¨ë© ¢ ਠâ (§ ª®¬¬¥â¨à®¢ ë©)
|
||
; § ⥬ ª®à®âª¨© «®£ á ¨á¯®«ì§®¢ ¨¥¬ ¬ ªà®á®¢
|
||
|
||
; mov eax,0 ; äãªæ¨ï 0: ®¯à¥¤¥«¨âì ®ª®
|
||
; mov ebx,200*65536+300 ; [x áâ àâ] *65536 + [x à §¬¥à]
|
||
; mov ecx,200*65536+150 ; [y áâ àâ] *65536 + [y à §¬¥à]
|
||
; mov edx, [sc.work] ; 梥â ä®
|
||
; or edx, 0x33000000 ; ¨ ⨯ ®ª 3
|
||
; mov edi,header ; ‡€ƒŽ‹Ž‚ŽŠ ŽŠ<C5BD>€
|
||
; int 0x40
|
||
|
||
mov edx, [sc.work] ; 梥â ä®
|
||
or edx, 0x33000000 ; ¨ ⨯ ®ª 3
|
||
mcall 0, <200,300>, <200,150>, , ,title
|
||
|
||
; ¢ë¢®¤ ⥪á⮢®© áâப¨
|
||
mov ecx, [sc.work_text] ; 梥â ä®
|
||
or ecx, 0x90000000 ; ¨ ⨯ áâப¨
|
||
mcall 4, <10, 20>, , message
|
||
|
||
|
||
mcall 12, 2 ; äãªæ¨ï 12.2, § ª®ç¨«¨ à¨á®¢ âì
|
||
|
||
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
|
||
|
||
|
||
;---------------------------------------------------------------------
|
||
;--- „€<E2809E><E282AC>›… <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||
;---------------------------------------------------------------------
|
||
|
||
; ‚®â â ª ï ¢®â ª®à®âª ï "¬¥«®¤¨ï".
|
||
; ‚â®à®© ¡ ©â ¨§¬¥ï¥âáï ¦ ⨥¬ ª« ¢¨èë
|
||
|
||
Music:
|
||
db 0x90, 0x30, 0
|
||
|
||
sc system_colors
|
||
|
||
message db '<27> ¦¬¨â¥ «î¡ãî ª« ¢¨èã...',0
|
||
title db '<27>ਬ¥à ¯à®£à ¬¬ë',0
|
||
|
||
;---------------------------------------------------------------------
|
||
|
||
I_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë
|
||
rb 4096 ; ¯ ¬ïâì ¤«ï á⥪
|
||
align 16
|
||
STACKTOP: ; ¬¥âª ¢¥àè¨ë á⥪ (¯à¨ § ¯®«¥¨¨ á⥪
|
||
; à áâ¥â ¢ áâ®à®ã 㬥ìè¥¨ï ¤à¥á®¢, ¯®â®¬ã
|
||
; ¯ ¬ïâì ¤«ï ¥£® ¢ ª®¤¥ ¯à®£à ¬¬ë ¢áâà¥ç ¥âáï
|
||
; à ìè¥ ç¥¬ ¥£® ¢¥àè¨ )
|
||
MEM: ; ¬¥âª 㪠§ë¢ îé ï ª®¥æ ¯à®£à ¬¬ë ¯«îá
|
||
; à §¬¥à ¨á¯®«ì§ã¥¬®© ¥î ®¯¥à ⨢®© ¯ ¬ïâ¨
|
||
; €¤à¥á ¬¥âª¨ MEM ¢á¥£¤ ¤®«¦¥ ¡ëâì ¡®«ìè¥ ç¥¬ ¤à¥á ¬¥âª¨ I_END.
|
||
; Œ¥âª STACKTOP ¤®«¦ à ᯮ« £ ¥âáï ¯®á«¥ ¬¥âª¨ I_END ¨ ¯¥à¥¤ ¬¥âª®©
|
||
; MEM. STACKTOP ¬®¦¥â 室¨âáï ¨ ¯¥à¥¤ I_END, ® íâ® ¥ ¯à ¢¨«ì®.
|
||
; ˆ¬¥ ¬¥â®ª ¬®£ãâ ¡ëâì á «î¡ë¬¨ §¢ ¨ï¬¨, £« ¢®¥ ᮡ«î¤ âì
|
||
; ¯à ¢¨«ìë© ¯®à冷ª ¨å à ᯮ«®¦¥¨ï. |