diff --git a/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm b/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm index 85a91c852a..80858c9d1b 100644 --- a/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm +++ b/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm @@ -38,7 +38,7 @@ START: ; start of execution mov [edi],dl sub edi,1 loop newnum - +red: call draw_window ; at first, draw the window still: @@ -55,10 +55,6 @@ still: jmp still - red: ; redraw - call draw_window - jmp still - key: ; key mov eax,2 ; just read it and ignore int 0x40 @@ -70,7 +66,7 @@ still: cmp ah,1 ; button id=1 ? jnz still - mov eax,-1 ; close this program + or eax,-1 ; close this program int 0x40 @@ -96,39 +92,18 @@ 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 + or edx,0x33000000 ; color of grab bar RRGGBB,8->color + mov edi,header ; WINDOW LABEL 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 ebx,20*65536+14 ; draw info text with function 4 mov ecx,[sc.work_text] mov edx,text - mov esi,40 - newline: + mov esi,24 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 @@ -140,12 +115,9 @@ draw_window: text: - db 'CPU RUNNING AT MHZ ' - db 'x' ; <- END MARKER, DONT DELETE + db 'CPU RUNNING AT MHZ' -labelt: - db 'CPU SPEED' -labellen: +header db 'CPU SPEED',0 I_END: diff --git a/programs/develop/examples/example/trunk/example.asm b/programs/develop/examples/example/trunk/example.asm index 42f26a493f..40ffc31ebd 100644 --- a/programs/develop/examples/example/trunk/example.asm +++ b/programs/develop/examples/example/trunk/example.asm @@ -103,42 +103,23 @@ draw_window: ; ‘Ћ‡„ЂрЊ ЋЉЌЋ ; 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 +; mov ecx,200*65536+50 ; [y бв ав] *65536 + [y а §¬Ґа] +; mov edx,0x33aabbcc ; 梥в а Ў®зҐ© ®Ў« бвЁ RRGGBB,8->color gl +; mov edi,header ; ‡ЂѓЋ‹Ћ‚ЋЉ ЋЉЌЂ ; int 0x40 - mcall 0, <200,200>, <200,50>, 0x02AABBCC, 0x805080D0, 0x005080D0 + mcall 0, <200,200>, <200,50>, 0x33AABBCC,,header - ; ‡ЂѓЋ‹Ћ‚ЋЉ ЋЉЌЂ -; 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 ebx,3 shl 16 + 8 ; 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 4, <3, 8>, 0, message, message.size mcall 12, 2 ; дг­ЄжЁп 12: б®®ЎйЁвм Ћ‘ ®Ў ®ваЁб®ўЄҐ ®Є­  ; 2, § Є®­зЁ«Ё аЁб®ў вм diff --git a/programs/develop/h2d2b/trunk/h2d2b.asm b/programs/develop/h2d2b/trunk/h2d2b.asm index 2eba5e2545..b526ff2aa2 100644 --- a/programs/develop/h2d2b/trunk/h2d2b.asm +++ b/programs/develop/h2d2b/trunk/h2d2b.asm @@ -1,3 +1,6 @@ +;; hex2dec2bin 0.2 by Alexei Ershov ;; +;; 16.11.2006 ;; + use32 ; включить 32-битный режим ассемблера org 0x0 ; адресация с нуля @@ -10,8 +13,7 @@ dd 0x0 ; адрес буфера для параметров (не используется) dd 0x0 ; зарезервировано -include 'lang.inc' -include 'macros.inc' ; макросы облегчают жизнь ассемблерщиков! +include 'MACROS.INC' ; макросы облегчают жизнь ассемблерщиков! START: @@ -109,8 +111,13 @@ next_digit: jmp next_digit .done: - mov [num], eax - + mov [num], eax ; сохраняем введенное число + xor eax, eax + mov al, ' ' + mov edi, string1 + mov [index], edi + mov ecx, string1_end-string1 + rep stosb ; стираем введенную строку jmp red ;--------------------------------------------------------------------- @@ -118,48 +125,66 @@ next_digit: button: mcall 17 ; 17 - получить идентификатор нажатой кнопки cmp ah, 1 ; если НЕ нажата кнопка с номером 1, - jne still ; вернуться + jne @f + mcall -1 +@@: + cmp ah, 2 + jne @f + shl [num], 1 + jmp red +@@: + cmp ah, 3 + jne @f + shr [num], 1 + jmp red +@@: + cmp ah, 4 + jne still + sar [num], 1 + jmp red - .exit: - mcall -1 ; иначе конец программы - -draw_window: +;------------------------------------------------ + 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 0, 200*65536+300, 200*65536+175, 0x13AABBCC,,header + + mcall 8, 15 *65536+ 38, 90*65536+ 15, 2, 0x6688DD ; кнопка shl + mcall , ,110*65536+ 15, , ; кнопка sal + mcall , (300-53)*65536+ 38, 90*65536+ 15, 3, ; кнопка shr + mcall , ,110*65536+ 15, 4, ; кнопка sar + + mcall 4, 15*65536+30, 0x80000000, binstr, 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 + mcall , 15*65536+58, ,sdecstr, + mcall , 15*65536+72, , hexstr, + mcall , 15*65536+150, , numstr, + mcall , 25*65536+93,0x10000000,shlstr,3 + mcall , (300-43)*65536+93, , shrstr, + mcall , 25*65536+113, , salstr, + mcall , (300-43)*65536+113, , sarstr, 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, + mcall , ,,(240-56)*65536+30, ror ecx, 8 - mcall , 8*65536+512,,(240-56*2)*65536+30, + mcall , ,,(240-56*2)*65536+30, ror ecx, 8 - mcall , 8*65536+512,,(240-56*3)*65536+30, + mcall , ,,(240-56*3)*65536+30, ror ecx, 8 - mov byte [minus], '+' + mov [minus], '+' jnc @f - mov byte [minus], '-' + mov [minus], '-' neg ecx @@: mcall , 10*65536,,228*65536+58, ; 10-ная со знаком mcall 4, 222*65536+58, 0, minus, 1 - call Draw_String - - + mcall 38, 15*65536+300-15, 137*65536+137, 0x006688DD + call Draw_String mcall 12, 2 ; функция 12: сообщить ОС об отрисовке окна ret @@ -167,19 +192,10 @@ 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 + mcall 4, 60*65536+150, 0x40A40473, \ + string1,string1_end-string1,0x00AABBCC + ret ;------------------------------------------------- GetBase: @@ -220,16 +236,19 @@ string1: db 34 dup(' ') string1_end: index dd string1 -num dd 0 + num dd 0 -header db 'hex2dec2bin' -header_e: + header db 'hex2dec2bin 0.2',0 minus db '-' - numstr db 'Number:' - hexstr db 'hex:' - binstr db 'bin:' - decstr db 'dec:' -sdecstr db 'signed dec:' + numstr db 'Number:',0 + hexstr db 'hex:',0 + binstr db 'bin:',0 + decstr db 'dec:',0 +sdecstr db 'signed dec:',0 + shlstr db 'shl' + salstr db 'sal' + shrstr db 'shr' + sarstr db 'sar' I_END: ; метка конца программы diff --git a/programs/develop/keyascii/trunk/keyascii.asm b/programs/develop/keyascii/trunk/keyascii.asm index dedaff03cf..31a96d8dd9 100644 --- a/programs/develop/keyascii/trunk/keyascii.asm +++ b/programs/develop/keyascii/trunk/keyascii.asm @@ -18,7 +18,7 @@ include 'lang.inc' include 'macros.inc' START: ; start of execution - + red: call draw_window still: @@ -35,10 +35,6 @@ still: jmp still - red: ; redraw - call draw_window - jmp still - key: ; key mov eax,2 ; just read it and ignore int 0x40 @@ -53,7 +49,7 @@ still: cmp ah,1 ; button id=1 ? jne noclose - mov eax,-1 ; close this program + or eax,-1 ; close this program int 0x40 noclose: @@ -78,20 +74,14 @@ 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 + mov edx,0x33ffffff ; color of work area RRGGBB,8->color gl + mov edi,header 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 - xor ecx,0xFFFFFF + xor ecx,ecx mov esi,4 - add ebx,23 + mov ebx,8*65536+8 mov edx,tdec int 0x40 add ebx,23 @@ -101,7 +91,7 @@ draw_window: mov ecx,[keyid] mov eax,47 mov ebx,3*65536 - mov edx,40*65536+31 + mov edx,40*65536+8 mov esi,0x224466 int 0x40 add edx,23 @@ -117,11 +107,9 @@ draw_window: ; DATA AREA - tdec: db 'DEC:' - thex: db 'HEX:' - labelt: - db 'KEYBOARD ASCIICODES-PRESS ANY KEY' -labellen:dd 0 -keyid:db 0 + tdec: db 'DEC:' + thex: db 'HEX:' + header db 'KEYBOARD ASCIICODES-PRESS ANY KEY',0 + keyid: db 0 I_END: diff --git a/programs/develop/scancode/trunk/scancode.asm b/programs/develop/scancode/trunk/scancode.asm index 847b9d14c5..71a232ab33 100644 --- a/programs/develop/scancode/trunk/scancode.asm +++ b/programs/develop/scancode/trunk/scancode.asm @@ -30,7 +30,7 @@ START: ; start of execution mov ecx,1 ; base keymap mov edx,keymap int 0x40 - + red: call draw_window still: @@ -48,11 +48,6 @@ still: jmp still - red: ; redraw - call draw_window - jmp still - - key: ; key mov eax,2 ; just read it and ignore int 0x40 @@ -167,24 +162,13 @@ 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 + or edx, 0x33000000 + mov edi, header ; WINDOW LABEL 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 ebx, 15*65536+10 + xor ecx, ecx mov edx, text mov esi, text.len int 0x40 @@ -202,7 +186,7 @@ draw_codes: mov eax,47 mov ebx,6*65536 - mov edx,20*65536+60 + mov edx,15*65536+35 mov edi,0 mov esi,0 newscan: @@ -211,7 +195,7 @@ draw_codes: shl ecx,16 add ecx,10 mov eax,13 ; filled rectangle - mov ebx,20*65536+160 + mov ebx,15*65536+160 mov edx,[sc.work] int 0x40 popa @@ -307,17 +291,13 @@ if lang eq ru db '‘—€’›‚Ђћ „ЂЌЌ›… ‘ Љ‹Ђ‚€Ђ’“ђ›' .len = $ - text - header: - db '‘ЉЂЌЉЋ„› Љ‹Ђ‚€Ђ’“ђ›' - .len = $ - header + header db '‘ЉЂЌЉЋ„› Љ‹Ђ‚€Ђ’“ђ›',0 else text: db 'READING RAW SCANCODE DATA' .len = $ - text - header: - db 'KEYBOARD SCANCODES' - .len = $ - header + header db 'KEYBOARD SCANCODES',0 end if ext db 0x0