; part of virtual processor, emulator for FIFTH xtvidput: mov ebx, edi ; read data from stack, and save it to variables mov eax, [es:ebx] mov [cory], eax add ebx, 4 mov eax, [es:ebx] mov [corx], eax add ebx, 4 mov eax, [es:ebx] add eax, [xms_addr] mov ecx, [es:eax] mov [img2x], ecx add eax, 4 mov ecx, [es:eax] mov [img2y], ecx add eax, 4 mov [img2a], eax add ebx, 4 mov eax, [es:ebx] add eax, [xms_addr] mov ecx, [es:eax] mov [img1x], ecx add eax, 4 mov ecx, [es:eax] mov [img1y], ecx add eax, 4 mov [img1a], eax add ebx, 4 mov edi, ebx cmp dword [cory] , 0 ; calculate Y start jl tvidl1 mov dword [starty], 0 jmp tvidl2 tvidl1: mov eax, [cory] neg eax mov [starty], eax tvidl2: cmp dword [corx] , 0 ; calculate X start jl tvidl3 mov dword [startx], 0 jmp tvidl4 tvidl3: mov eax, [corx] neg eax mov [startx], eax tvidl4: mov eax, [cory] ; calculate Y end add eax, [img1y] cmp eax, [img2y] jg tvidl5 mov eax, [img1y] mov [endy], eax jmp tvidl6 tvidl5: mov eax, [img2y] sub eax, [cory] mov [endy], eax tvidl6: mov eax, [corx] ; calculate X end add eax, [img1x] cmp eax, [img2x] jg tvidl7 mov eax, [img1x] mov [endx], eax jmp tvidl8 tvidl7: mov eax, [img2x] sub eax, [corx] mov [endx], eax tvidl8: mov eax, [endy] ; calculate Y length sub eax, [starty] cmp eax, 0 jle emu mov [lengthy], eax mov eax, [endx] ; calculate X length sub eax, [startx] cmp eax, 0 jle emu mov [lengthx], eax mov eax, [starty] ; calculate img1 start address mov ebx, [img1x] sub edx, edx mul ebx add eax, [img1a] add eax, [startx] mov [img1start], eax mov eax, [cory] ; calculate img2 start address add eax, [starty] mov ebx, [img2x] sub edx, edx mul ebx add eax, [img2a] add eax, [corx] add eax, [startx] mov [img2start], eax tvidl9: mov ebx, [img1start] mov ecx, [lengthx] mov edx, [img2start] tmemmove: ; ebx - from, edx - to, ecx - amount cmp ecx, 0 je tl11 mov al, [es:ebx] cmp al, 255 je tl12 mov [es:edx], al tl12: inc ebx inc edx dec ecx jmp tmemmove tl11: mov eax, [img1x] add [img1start], eax mov eax, [img2x] add [img2start], eax dec dword [lengthy] cmp [lengthy], 0 jg tvidl9 jmp emu