kolibrios-fun/programs/media/paint/trunk/PAINT.ASM

332 lines
11 KiB
NASM
Raw Permalink Normal View History

;*********************************
;* *
;* PAINT 0.02 <20><><EFBFBD> MenuetOS *
;* *
;* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD> FASM'<27><> *
;* *
;*********************************
;******************************************************************************
; <20><><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> <20><> <20><EFBFBD> <20><><EFBFBD><EFBFBD><ECA5A7> <20><><EFBFBD><EFBFBD><EFBFBD><E0A8A2><EFBFBD> - <20><><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AC>,
; <20> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><><E0A0A1><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><20><EFBFBD><E3ADAA><20><><EFBFBD><EFBFBD>,
; <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E0ACA0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E0A5A4><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⮩,
; <20> <20><><EFBFBD> <20><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD> ⮫쪮 <20><><EFBFBD><E7A8AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E1A5AC><EFBFBD><EFBFBD>,
; <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0A5AC><EFBFBD><EFBFBD><><E1A4A5><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
; <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E2A8AC><EFBFBD><EFBFBD><E0AEA2>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E3A4AD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0A0AB> <20><><EFBFBD>⥫쭮 <20><EFBFBD><E0AEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD>
; ᫮<><E1ABAE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> <20><EFBFBD><E0A8AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>, <20> Sniper'<27>, <20><><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>饬-<2D><> <20><><EFBFBD> <20> <20><><EFBFBD><E1A0AB><EFBFBD>.
; <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><E7A5AD> <20>ᬠ!
; <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E3A1AD>, ivan-yar@bk.ru
;******************************************************************************
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
include '../../../macros.inc'
;******************************************************************************
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; title version
dd START ; start of code
dd I_END ; size of image
dd E_END ; memory for app
dd E_END ; esp
dd 0x0,0x0 ; I_Param , I_Icon
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
START:
mov eax,40 ; ᮮ<><20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD> <20><EFBFBD> <20><><EFBFBD><E0A0A1><EFBFBD><EBA2A0>
mov ebx,0100101b ; <20><>᪠ ᮡ<>⨩ - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2> (1) + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (3) + <20><><EFBFBD><EFBFBD> (6
int 0x40 ; <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EBA2A0> <20><><EFBFBD><EFBFBD><E2A5AC><EFBFBD> <20><EFBFBD><E3ADAA><EFBFBD>
mov [workarea.cx],5 ; <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD><>祩 (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov [workarea.cy],30 ; <20><><EFBFBD> <20><><EFBFBD><E1AEA2><EFBFBD><EFBFBD>
red:
call draw_window ; <20><><EFBFBD><EFBFBD><EBA2A0> <20><><EFBFBD><EFBFBD><E6A5A4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>
still: ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax,10 ; <20><EFBFBD><E3ADAA><EFBFBD> 10 - <20><><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD>; <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
int 0x40 ; ᫥<><E1ABA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD> <20><EFBFBD><EBAFAE><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD>
; <20><> <20><EFBFBD><E0AEA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>
; ⥯<><E2A5AF><EFBFBD><><E0A5A3><EFBFBD><EFBFBD> eax ᮤ<><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0A5A4> <20><EFBFBD><E0A0A2><EFBFBD> <20><><EFBFBD> <20><> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD>ﬨ, <20><EFBFBD> <20><EFBFBD><EBA7A2><EFBFBD>
; <20><EFBFBD><E3A6AD> <20><><EFBFBD><E0A0A1>
cmp eax,1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD> ?
je red ; <20>᫨ ॣ<><E0A5A3><EFBFBD><EFBFBD> eax ࠢ<><E0A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> red
cmp eax,3 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ?
je button
cmp eax,6 ; <20><><EFBFBD><EFBFBD>?
je mouse
jmp still ; <20><20><EFBFBD><E0AEA8>諮 ᮡ<>⨥, <20><><EFBFBD><EFBFBD><20><> <20><> <20><><EFBFBD><E0A0A1><EFBFBD><EBA2A0>,
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A0A5><EFBFBD> <20> <20><><EFBFBD><><E6A8AA>, <20><><EFBFBD><EFBFBD><><E2A0AA><EFBFBD> <20><><EFBFBD><EFBFBD>
; <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>! <20>.<2E>. <20><20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>
; <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E8ADAE> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
;******************************************************************************
button: ; <20><><EFBFBD><E0A0A1><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
mov eax,17 ; <20><EFBFBD><E3ADAA><EFBFBD> N17 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40
; ⥯<><E2A5AF><EFBFBD> <20><><E0A5A3><EFBFBD><EFBFBD><EFBFBD> ah ᮤ<><EFBFBD><E0A6A8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD>.
shr eax,8 ; ah -> al (ᤢ<><E1A4A2> <20><> 8 <20><><EFBFBD> <20><><EFBFBD>)
dec al ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--;
jnz .noclose ; <20>᫨ १<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A5A4><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E0A0A2> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EBA2A0><EFBFBD><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> noclose
or eax,-1 ; <20><><20><> <20>ணࠬ<E0AEA3><E0A0AC>
int 0x40
.noclose:
; <20><20><> <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><><E0A0A2> <20><><EFBFBD><EFBFBD>...
; ⥯<><E2A5AF><EFBFBD> <20> <20><><EFBFBD> <20> eax ᮤ<><EFBFBD><E0A6A8><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD> 梥⭮<E6A2A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 1),
; <20>.<2E> <20><><EFBFBD> 1, <20><><EFBFBD> 2, ... ,<2C><><EFBFBD> 5
; 㬥<><E3ACA5><20><> 1:
dec eax
; <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> eax <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1ABAE> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> colors+eax*4
; <20><><EFBFBD> colors - ᬥ饭<E1ACA5><E9A5AD> <20><>⪨ colors, <20><><20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD>⥫쭮<E2A5AB><ECADAE><EFBFBD>
; 梥⮢, eax*4 - <20><><EFBFBD><EFBFBD><EFBFBD><><E6A2A5>, 㬭<><E3ACAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 4, <20>.<2E>. <20><> <20><><EFBFBD><EFBFBD><> <20><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.
mov eax,[colors+eax*4]
; ⥯<><E2A5AF><EFBFBD> <20><> <20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><>, ᮤ<>ঠ騩<E0A6A0><E9A8A9> <20><><E0A5A3><EFBFBD><EFBFBD><EFBFBD> eax <20><><EFBFBD> <20><EFBFBD><E1ADAE><EFBFBD><EFBFBD>:
mov [active_color],eax
; <20><> <20><><EFBFBD>, ᮡ<><EFBFBD><E2A2A5><EFBFBD>, <20> <20><><EFBFBD>, <20><><EFBFBD> <20><> <20><><EFBFBD> <20><EFBFBD><E0A5A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ;)
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><><E6A8AA> <20><><EFBFBD>⪨ ᮡ<>
jmp still
;******************************************************************************
mouse: ; <20><><EFBFBD><E0A0A1><20><><EFBFBD><EFBFBD>
mov eax,37 ; ᭠砫<E1ADA0> <20><><EFBFBD><EFBFBD>稬 ⥪<><20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
mov ebx,1
int 0x40
mov ebx,eax ; <20><EFBFBD>ࠧ㥬 <20><>
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 ; <20><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
jle .not_pressed ; <20><><EFBFBD> <20><> <20><><EFBFBD>
cmp eax,[workarea.sx] ; <20><20><><EFBFBD><EFBFBD> <20><EFBFBD><E0A0A2>...
jae .not_pressed
sub ebx,[workarea.cy]
cmp ebx,0 ; ...<2E><><EFBFBD><EFBFBD>...
jle .not_pressed
cmp ebx,[workarea.sy] ; ...<2E><><EFBFBD><EFBFBD>...
jae .not_pressed
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
mov eax,37
mov ebx,2
int 0x40
; <20><20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28>.<2E>. eax = 1), <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cmp eax,1
je .leftbtn
.not_pressed:
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD>
mov [mouse_pressed],0 ; <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax,37 ; <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD>
mov ebx,1
int 0x40
mov ebx,eax
shr eax,16
and ebx,0xffff
mov [old_x],eax ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
mov [old_y],ebx
jmp still
.leftbtn:
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
mov [mouse_pressed],1
; <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><EFBFBD><E2ADAE>⥫쭮 <20><><EFBFBD><EFBFBD>)
mcall 37,1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
; <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20><> ⠪, <20><EFBFBD> <20><><EFBFBD> <20><20><><E0A0A7><EFBFBD><><E0A5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>.<2E>. eax <20> ebx
mov ebx,eax
shr eax,16
and ebx,0xffff
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2AEA2> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD> <20><><EFBFBD> <20>㭪樨 <20><><EFBFBD><E1AEA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
mov ecx,[old_x] ; <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD>
mov edx,[old_y]
mov [old_x],eax ; ⥯<><E2A5AF><EFBFBD> <20><><EFBFBD><EFBFBD><E0A0AD><><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov [old_y],ebx
shl ecx,16 ; <20> <20><><EFBFBD><EFBFBD><><E1ABAE> <20><><EFBFBD><E7A0AB><EFBFBD><EFBFBD> (⥪<>騥) <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD>
shl edx,16
add eax,ecx ; <20> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1ABAE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>.<2E>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
add ebx,edx
mov ecx,ebx ; <20><><EFBFBD><EFBFBD><EFBFBD>塞 ॣ<><E0A5A3><EFBFBD><EFBFBD><EFBFBD> ⠪, <20><><EFBFBD> <20><><EFBFBD> <20><EFBFBD> 38 <20>㭪樨
mov ebx,eax
mov eax,38 ; <20><><EFBFBD><EFBFBD><EFBFBD> <20>㭪樨 <20> eax
mov edx,[active_color] ; <20> edx 梥<>
int 0x40
;  - <20><><EFBFBD><EFBFBD><E0AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E2A0A2><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><E7A5AD> (00090001)
mov edi,0x00010001 ; <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20>뫠 ᫨誮<E1ABA8><><E2AEAD><EFBFBD>,
add ebx,edi ; <20><><EFBFBD><EFBFBD><EFBFBD><20><EFBFBD> <20><><EFBFBD> 3!
int 0x40
add ecx,edi
int 0x40
sub ebx,edi
int 0x40
sub ebx,edi ; <20><> <20> <20><EFBFBD><><EFBFBD><E0A5AB><EFBFBD> ᮢᥬ <20><><EFBFBD><EFBFBD><EFBFBD>,
int 0x40 ; <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD> 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,[proc_info.box.width]
add eax,[workarea.cx]
mov ebx,[proc_info.box.height]
add ebx,[workarea.cy]
jmp still
;******************************************************************************
; *********************************************
; ******* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> *******
; *********************************************
draw_window:
mcall 48,3,sc,sizeof.system_colors ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
mcall 12, 1 ; <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>
mov edx, [sc.work]
or edx, 0x33000000
mcall 0, (100 shl 16)+400, (100 shl 16)+300, , , title ; <20><><EFBFBD><20><><EFBFBD><EFBFBD>
mcall 12, 1
mcall 9,proc_info,-1 ; <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD> <20><><E1A2AE> <20><><EFBFBD>
mov eax,[proc_info.box.width] ; <20><><EFBFBD><EFBFBD><EFBFBD><><E0A0A7><EFBFBD><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sub eax,20 ; (<28><><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD> - 20)
mov [workarea.sx],eax
mov eax,[proc_info.box.height]
sub eax,63 ; (<28><><E0A0A7><EFBFBD> - 63)
mov [workarea.sy],eax
cmp [proc_info.box.height],80
jb .finish
mov eax, 8
mov edx, 1
; ᮧ<><E1AEA7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EBA1AE><><E6A2A5>:
mov ebx,10*65536+15 ; <20><>砫쭠<E7A0AB> x <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><E0A0A7><EFBFBD>
mov ecx, 7*65536+15 ; <20><>砫쭠<E7A0AB> y <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> & size
.new_button:
inc edx ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD>++;
mov esi,[btn_colors-8+edx*4] ; 梥<> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40 ; <20><EFBFBD><E2A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
add ebx,18*65536 ; ᫥<><E1ABA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A0A2> <20><> 12
cmp edx,9 ; <20><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> edx (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD>) <20> 9
jbe .new_button ; <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><><E0A0A2> -> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
mov eax,13 ; <20><><EFBFBD>⨬ "宫<><E5AEAB>" - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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
mcall 13
.finish:
ret
;******************************************************************************
; <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; <20><20><><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD>", <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
; <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E1A2AE><EFBFBD> <20><>砫쭮<E7A0AB> <20><><EFBFBD><EFBFBD><E7A5AD>
;data
title db 'Simple Paint v0.3',0
mouse_pressed db 0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><20><><EFBFBD><EFBFBD> <20> <20><EFBFBD><E0A5A4><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; 梥<><E6A2A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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
; 梥<><E6A2A5> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><20><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><E6A2A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
colors:
dd 0xffffff ; <20><><EFBFBD><EFBFBD><EFBFBD>
dd 0x000000 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd 0x00ff00 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd 0x0000ff ; ᨭ<><E1A8AD>
dd 0xff0000 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd 0xff00ff ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd 0xffff00 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd 0x00ffff ; <20><><EFBFBD><EFBFBD>
dd 0x77bb77 ; ⥯<><E2A5AF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
;******************************************************************************
; <20> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><E7A8AD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>.<2E>.
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E7A5AD> <20><> <20><><EFBFBD><EFBFBD><E1A2AE><EFBFBD>. <20> <20>⫨稥 <20><> <20><><EFBFBD><EFBFBD>., <20><><><E3A2A5><EFBFBD><E7A8A2><EFBFBD><><E0A0A7><EFBFBD>
; 䠩<><E4A0A9>
I_END:
active_color dd ? ; <20><><EFBFBD><E2A8A2><EFBFBD><>
old_x dd ? ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
old_y dd ?
workarea: ; <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><E0A0A7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.cx dd ? ; c - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.cy dd ?
.sx dd ? ; s - ࠧ<><E0A0A7><EFBFBD><EFBFBD>
.sy dd ?
sc system_colors ; <20><><EFBFBD><EFBFBD><E2A5AC><EFBFBD><><E6A2A5>
proc_info process_information ; <20><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
restflag dd ?
canvas rb 800*600*3
E_END: