diff --git a/programs/other/qrclipboard/qrclipboard.asm b/programs/other/qrclipboard/qrclipboard.asm new file mode 100644 index 000000000..64657a564 --- /dev/null +++ b/programs/other/qrclipboard/qrclipboard.asm @@ -0,0 +1,218 @@ +; QR code generator from clipbboard +; +; This program uses code from someone else's program, so the notice below +; is kept for compliance purposes. + + +;***************************************************************************** +; Read the data from the clipboard +; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; * Neither the name of the nor the +; names of its contributors may be used to endorse or promote products +; derived from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY +; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +; DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;****************************************************************************** + use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd IM_END + dd I_END + dd stacktop + dd 0x0 + dd 0x0 +;--------------------------------------------------------------------- +include 'macros.inc' + +START: + mcall 68,11 +red: + call draw_window +still: + mcall 10 + + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + + jmp still + +key: + mcall 2 + jmp still + +button: + mcall 17 + cmp ah,2 + je .read_button + cmp ah,1 + jne still +.exit: + mcall -1 + +.read_button: + call draw_clipboard + jmp still + +draw_window: + mcall 12,1 + xor esi,esi + mcall 0,<0,600>,<0,400>,0x13FFFFFF,,title + mcall 8,<20,150>,<40,20>,2,0xCCCCCC + mcall 4,<25,47>,0x90000000,read_button_text + mcall 12,2 + ret + +draw_clipboard: + mcall 54,0 + cmp eax,-1 + je exit + + test eax,eax + jz exit + + mov [slots_number],eax + dec eax + mov [current_slot],eax + + mov [text_coordinates],dword 10 shl 16+70 +start: + xor eax,eax + mov [current_slot_data],eax + mcall 54,1,[current_slot] + + cmp eax,-1 + je .no_relevant_data + + cmp eax,1 + jne @f + +.no_relevant_data: + mov edx,no_relevant_data_text + mov esi,no_relevant_data_text.end-no_relevant_data_text + jmp print +.no_relevant_data_1: + mov edx,no_relevant_data_text_1 + mov esi,no_relevant_data_text_1.end-no_relevant_data_text_1 + jmp print +.no_relevant_data_2: + mov edx,no_relevant_data_text_2 + mov esi,no_relevant_data_text_2.end-no_relevant_data_text_2 + jmp print +@@: + mov [current_slot_data],eax + mov eax,[current_slot_data] + mov esi,[eax] + sub esi,12 + add eax,4 + cmp [eax],dword 2 + jge .no_relevant_data_1 + add eax,4 + ;cmp [eax],dword 1 ; cp866 + ;je .no_relevant_data_2 ; + + + ;push 0 + cmp [eax], dword 0 + jne @f + ; push 26 + jmp skip2 +@@: + cmp [eax], dword 2 + jne @f + ;push 22 + jmp skip2 +@@: + + +skip2: + + add eax,4 +mov edx, matrix + mov ebx, eax + mov ecx, esi + mov eax, 78 + int 0x40 + +mov ebx, matrix + mov ecx, eax + shl ecx, 16 + add ecx, eax + mov eax, 7 + mov edx, 40 + shl edx, 16 + add edx, 80 + int 0x40 +doneQR: +print: + mov ecx,[current_slot_data] + test ecx,ecx + jz @f +@@: + add [text_coordinates],dword 15 + dec dword [current_slot] + dec dword [slots_number] +exit: + ret + + +;--------------------------------------------------------------------- +title: + db 'Make QR code from the clipboard ',0 +read_button_text: + db 'Make QR code ',0 +no_relevant_data_text: + db '',0 +.end: +no_relevant_data_text_1: + db '',0 +.end: +no_relevant_data_text_2: + db '',0 +.end: +;--------------------------------------------------------------------- +IM_END: +slots_number: + rd 1 +text_coordinates: + rd 1 +current_slot: + rd 1 +current_slot_data: + rd 1 + +;---------------------- + +matrix DD 31330 * 3 DUP (?) + +;-------------------------------------- + rb 5555 +stacktop: + rb 4 +;--------------------------------------------------------------------- +I_END: +;--------------------------------------------------------------------- \ No newline at end of file