2006-01-03 10:43:31 +01:00
|
|
|
;
|
|
|
|
; MAGNIFY SCREEN
|
|
|
|
;
|
|
|
|
; Compile with FASM for Menuet
|
|
|
|
;
|
|
|
|
|
|
|
|
use32
|
|
|
|
|
|
|
|
org 0x0
|
|
|
|
|
2006-11-07 17:11:51 +01:00
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
dd 1 ; header version
|
2006-01-03 10:43:31 +01:00
|
|
|
dd START ; program start
|
|
|
|
dd I_END ; program image size
|
2006-11-07 17:11:51 +01:00
|
|
|
dd 0x1000 ; required amount of memory
|
|
|
|
dd 0x1000 ; esp
|
|
|
|
dd 0, 0 ; no parameters, no path
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
include '..\..\..\macros.inc'
|
2006-11-07 17:11:51 +01:00
|
|
|
delay equ 20
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-11-07 17:11:51 +01:00
|
|
|
magnify_width = 40
|
|
|
|
magnify_height = 30
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
START: ; start of execution
|
2006-11-07 17:11:51 +01:00
|
|
|
redraw:
|
|
|
|
call draw_window
|
2006-01-03 10:43:31 +01:00
|
|
|
still:
|
2006-11-07 17:11:51 +01:00
|
|
|
call draw_screen
|
|
|
|
wtevent:
|
|
|
|
mov eax, 23 ; wait here for event with timeout
|
|
|
|
mov ebx, delay
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-11-07 17:11:51 +01:00
|
|
|
dec eax
|
|
|
|
js still
|
|
|
|
jz redraw
|
|
|
|
dec eax
|
|
|
|
jnz button
|
|
|
|
; key in buffer
|
|
|
|
mov al, 2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-11-07 17:11:51 +01:00
|
|
|
jmp wtevent
|
|
|
|
button:
|
|
|
|
; we have only one button, close
|
|
|
|
or eax, -1
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
; *********************************************
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
draw_window:
|
2006-11-07 17:11:51 +01:00
|
|
|
mov eax, 12 ; function 12:tell os about windowdraw
|
|
|
|
mov ebx, 1 ; 1, start of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-11-07 17:11:51 +01:00
|
|
|
mov al, 48 ; function 48 : graphics parameters
|
|
|
|
mov bl, 4 ; subfunction 4 : get skin height
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-11-07 17:11:51 +01:00
|
|
|
; DRAW WINDOW
|
|
|
|
mov ebx, 100*65536 + 8*magnify_width + 8
|
|
|
|
lea ecx, [eax + 100*65536 + 8*magnify_height + 3]
|
|
|
|
mov edx, 0x33000000 ; color of work area RRGGBB
|
|
|
|
mov edi, labelt ; header
|
|
|
|
xor eax, eax ; function 0 : define and draw window
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
2006-11-07 17:11:51 +01:00
|
|
|
mov al, 12 ; function 12:tell os about windowdraw
|
|
|
|
mov ebx, 2 ; 2, end of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-11-07 17:11:51 +01:00
|
|
|
ret
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
draw_screen:
|
|
|
|
draw_magnify:
|
2006-11-07 17:11:51 +01:00
|
|
|
mov eax, 14
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall ; get screen size
|
2006-11-07 17:11:51 +01:00
|
|
|
movzx ecx, ax
|
|
|
|
inc ecx
|
|
|
|
mov [size_y], ecx
|
|
|
|
shr eax, 16
|
|
|
|
inc eax
|
|
|
|
mov [size_x], eax
|
|
|
|
|
|
|
|
mov eax, 37
|
|
|
|
xor ebx, ebx
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall ; get mouse coordinates
|
2006-11-07 17:11:51 +01:00
|
|
|
mov ecx, eax
|
|
|
|
shr ecx, 16 ; ecx = x
|
|
|
|
movzx edx, ax ; edx = y
|
|
|
|
inc ecx
|
|
|
|
mov [m_xe], ecx
|
|
|
|
inc edx
|
|
|
|
mov [m_ye], edx
|
|
|
|
sub ecx, magnify_width
|
|
|
|
sub edx, magnify_height
|
|
|
|
mov [m_x], ecx
|
|
|
|
mov [m_y], edx
|
|
|
|
.loop_y:
|
|
|
|
.loop_x:
|
|
|
|
xor eax, eax ; assume black color for invalid pixels
|
|
|
|
test ecx, ecx
|
|
|
|
js .nopix
|
|
|
|
cmp ecx, [size_x]
|
|
|
|
jge .nopix
|
|
|
|
test edx, edx
|
|
|
|
js .nopix
|
|
|
|
cmp edx, [size_y]
|
|
|
|
jge .nopix
|
|
|
|
mov ebx, edx
|
|
|
|
imul ebx, [size_x]
|
|
|
|
add ebx, ecx
|
|
|
|
mov eax, 35
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall ; read pixel
|
2006-11-07 17:11:51 +01:00
|
|
|
.nopix:
|
|
|
|
push ecx edx
|
|
|
|
sub ecx, [m_x]
|
|
|
|
sub edx, [m_y]
|
|
|
|
mov ebx, ecx
|
|
|
|
shl ebx, 3+16
|
|
|
|
mov bl, 7
|
|
|
|
mov ecx, edx
|
|
|
|
shl ecx, 3+16
|
|
|
|
mov cl, 7
|
|
|
|
mov edx, eax
|
|
|
|
mov eax, 13
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-11-07 17:11:51 +01:00
|
|
|
pop edx ecx
|
|
|
|
inc ecx
|
|
|
|
cmp ecx, [m_xe]
|
|
|
|
jnz .loop_x
|
|
|
|
mov ecx, [m_x]
|
|
|
|
inc edx
|
|
|
|
cmp edx, [m_ye]
|
|
|
|
jnz .loop_y
|
|
|
|
ret
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
labelt:
|
2006-11-07 17:11:51 +01:00
|
|
|
db 'MAGNIFIER - MOVE MOUSE POINTER', 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
I_END:
|
2006-11-07 17:11:51 +01:00
|
|
|
align 4
|
|
|
|
m_x dd ?
|
|
|
|
m_y dd ?
|
|
|
|
m_xe dd ?
|
|
|
|
m_ye dd ?
|
|
|
|
size_x dd ?
|
|
|
|
size_y dd ?
|