Author Topic: AOW32  (Read 6582 times)

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
AOW32
« on: September 11, 2015, 04:39:05 AM »
Hello. I've finally decided to release AOW32 now. It is far from finished and there're several things that I have to change. But maybe it could be useful for anyone.

It would be great to receive any feedback (constructive comments). Not just, view, take, run and forget.

I have market several things as wrong that I belive that I can fix (when I have time).

Regards,
alfonso
En un lugar de la Mancha de cuyo nombre no quiero acordarme

HSE

  • Member
  • ****
  • Posts: 545
  • <AMD>< 7-32>
Re: AOW32
« Reply #1 on: September 11, 2015, 09:14:01 AM »
Hola Alfonso!

El menú va cambiando entre uno en el que el capítulo 02 es Estructuras y uno en el capítulo 02 es Demos Gráficas. Parece que algunas cosas son de AOWG y otras AOW32.

Lo que quise descargar parece que no está ahí. Muy buena pinta los demos (te digo más cuando pueda descargar alguno, ja, ja). Justo uno que está en su lugar me lo bloqueo el antivirus porque lo quise ejecutar directamente.

Saludos. HSE 

Mikl__

  • Member
  • ****
  • Posts: 550
Re: AOW32
« Reply #2 on: September 11, 2015, 03:56:33 PM »
Hola Alfonso!
No puedo llegar a su sitio web desde una computadora en mi trabajo desde que obtuvo el mensaje
Quote
Abreojosensamblador.net Sitio puede representar una amenaza
¿Qué pasó
Yandex encontrar en este código malicioso sitio que puede infectar su computadora con un virus o el acceso a su información personal.
En la configuración de tu red prohibido páginas de demostración de este tipo de recursos.

Más información sobre el código malicioso
Qué hacer a continuación
Ver copia guardada segura
Quote
Сайт abreojosensamblador.net может представлять угрозу
Что произошло
Яндекс обнаружил на этом сайте вредоносный программный код, который может заразить ваш компьютер вирусом или получить доступ к вашей личной информации.
В настройках вашей сети запрещён показ страниц с подобных ресурсов.

Подробнее про вредоносный код
Что делать дальше
Просмотреть безопасную сохранённую копию
link

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
Re: AOW32
« Reply #3 on: September 11, 2015, 05:21:51 PM »
A ver si la WiFi me permite contestaros. Gracias. He reutilizado el proyecto html de aowg. Las paginas en inglés siguen con el mismo texto. Lo voy traduciendo poco a poco. Mikl__, dime si no puedes acceder de otra manera porque son sobre 9 mb
En un lugar de la Mancha de cuyo nombre no quiero acordarme

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
Re: AOW32
« Reply #4 on: September 11, 2015, 05:30:06 PM »
Desde que publique aowg en mi sitio, yandex lo consideró sospechoso. Parece que muchos av consideran sospechoso muchos programas que no llevan info ni iconos. Además parece que tinyc suele ser muy proclive a ello.
En un lugar de la Mancha de cuyo nombre no quiero acordarme

Mikl__

  • Member
  • ****
  • Posts: 550
Re: AOW32
« Reply #5 on: September 11, 2015, 05:56:16 PM »
Alfonso, voy a tratar en mi ordenador personal. La verdad es que hay acceso a la red bastante lento

anta40

  • Member
  • ***
  • Posts: 293
Re: AOW32
« Reply #6 on: September 12, 2015, 03:45:55 AM »
Hi Alfonso

The download link:
Quote
http://abreojosensamblador.net/Productos/AOW32/html/Libro/AOWG.025.7z

Doesn't seem to work properly

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
Re: AOW32
« Reply #7 on: September 12, 2015, 05:12:48 AM »
Yes, I'm sorry. I did it un a hurry, reusing the aowg project, and many things of this remains here. The English versión isn't available either for now. But I'm working on it to be ready as son as I can.

Regards
En un lugar de la Mancha de cuyo nombre no quiero acordarme

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
Re: AOW32
« Reply #8 on: September 17, 2015, 01:30:30 AM »
Hello.

1. I did my best translating it to English.
2. Added some things like join text and images on a button creating a compatible bitmap on the fly.
3. Added 7zipped project to download. It is needed for some programs to compile and run properly.

Regards
En un lugar de la Mancha de cuyo nombre no quiero acordarme

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
Re: AOW32
« Reply #9 on: October 05, 2015, 04:44:49 AM »
Knock, knock. HHHmmmm, anybody there?

Never mind, I have uploaded it with several fixings and some new things, though in the Spanish side, no time for translating...

See you
En un lugar de la Mancha de cuyo nombre no quiero acordarme

Mikl__

  • Member
  • ****
  • Posts: 550
Re: AOW32
« Reply #10 on: October 27, 2015, 04:33:06 PM »
Hola Alfonso!
¿Cómo está tu salud? ¿Cómo está tu hijo?
Hoja del helecho del fractal en 64 bits -- esto es simple, aún más simple y muy sencillamente
asm-file
Code: [Select]
include win64a.inc
include gdi32.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y;macro for transfer a real value to a local variable
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local r:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
mov XCC,rbx
mov YCC,rbx
mov i,ebx
loc_4015A0:mov eax, i
cmp eax, 150000
jae wmBYE
call rand
mov ecx,10000
cdq
idiv ecx
mov r,edx
cmp edx, 100
ja @f
mov a,ebx;a = 0
mov b,ebx; b = 0
        mov c,ebx; c = 0
movr d, 0.16
mov f,ebx; f = 0
jmp loc_4016FE
@@: mov eax, r
cmp eax, 800
ja @f
movr a, -0.15
movr b, 0.28
movr c, 0.26
movr d, 0.24
movr f, 0.44
jmp loc_4016FE
@@: cmp eax,1500
ja @f
movr a, 0.20
movr b, -0.26
movr c, 0.23
movr d, 0.22
jmp loc_4016FF
@@: movr a,0.85
movr b, 0.04
movr c, -0.04
movr d, 0.85
loc_4016FF:movr f, 1.60 ; f = 1.60
loc_4016FE:fld a     
fmul XCC
fld b
fmul YCC
faddp
fstp NewX    ;NewX = a * XCC + b * YCC
fld c
fmul XCC
fld d
fmul YCC
faddp
fadd f
fstp NewY    ;NewY = c * XCC + d * YCC + f
fld const40
fmul NewX
fadd const320
fistp x       ;x = (int) (NewX*40+cdXSize/2)
fld1
fsub NewY
fmul const40
fadd const365
fistp y       ; y = (int) ((1-NewY)*40+cdYSize-35)
cmp x,cdXSize
jae @f
cmp y,cdYSize
jae @f
mov eax,2560
mul y
add rax,pMainDIB
mov ecx, x
mov dword ptr [rax+rcx*4],0FF00h ;*(pMainDIB + (y<<9)+(y<<7)+x) = 0xFF00;
@@: fld NewX  ;XCC = NewX
fstp XCC
fld NewY  ;YCC = NewY
fstp YCC
inc i
jmp loc_4015A0
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Fern Leaf Fractal - (c) abreojosensamblador.net',0
bi BITMAPINFO <<28h,640,-430,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const40 dq 4.0e1
const320 dq 3.2e2
const365 dq 3.65e2
end
bat-file
Code: [Select]
cls
set masm64_path=\masm64\
set filename=%1
del %filename%.exe
if exist %1.rc (
%masm64_path%bin\RC /r  %filename%.rc || exit
%masm64_path%bin\ml64 /Cp /c /I"%masm64_path%Include" %filename%.asm || exit
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/entry:WinMain %filename%.obj %filename%.res /LARGEADDRESSAWARE:NO ^
/ALIGN:16 /SECTION:.text,W ^
/BASE:0x400000 /STUB:%masm64_path%\bin\stubby.exe || exit
del %filename%.res
) else (
%masm64_path%bin\ml64 /Cp /c /I"%masm64_path%Include" %filename%.asm || exit
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/entry:WinMain %filename%.obj /LARGEADDRESSAWARE:NO ^
/ALIGN:16 /SECTION:.text,W ^
/BASE:0x400000 /STUB:%masm64_path%\bin\stubby.exe || exit
)
del %filename%.obj
« Last Edit: November 06, 2015, 12:06:00 PM by Mikl__ »

Mikl__

  • Member
  • ****
  • Posts: 550
Re: AOW32
« Reply #11 on: November 02, 2015, 08:17:12 PM »
Hola Alfonso!
Fractal Tree
asm-file
Code: [Select]
; masm windows gui #
.686
.model flat
includelib user32.lib
includelib kernel32.lib
includelib gdi32.lib
includelib msvcrt.lib
include windows.inc
extern _imp__BeginPaint@8:dword
extern _imp__BitBlt@36:dword
extern _imp__CreateWindowExA@48:dword
extern _imp__CreateCompatibleDC@4:dword
extern _imp__CreateDIBSection@24:dword
extern _imp__DefWindowProcA@16:dword
extern _imp__DispatchMessageA@4:dword
extern _imp__DeleteObject@4:dword
extern _imp__DeleteDC@4:dword
extern _imp__DestroyWindow@4:dword
extern _imp__EndPaint@8:dword
extern _imp__ExitProcess@4:dword
extern _imp__GetDC@4:dword
extern _imp__GetMessageA@16:dword
extern _imp__GetTickCount@0:dword
extern _imp__rand:dword
extern _imp__RegisterClassA@4:dword
extern _imp__ReleaseDC@8:dword
extern _imp__SelectObject@8:dword

cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 400
cdXSize         equ 640 ;cdYSize*1.6
c1              equ 27
c2              equ 6
c3              equ 3
stPaleta struct
  Azul db ?
  Verde db ?
  Rojo db ?
  Alfa db ?
stPaleta ends
.code
start: xor ebx,ebx
        mov edi,offset wTitle
        mov esi,400000h
push edi
push ebx
push BLACK_PEN
push 10011h
push ebx
push esi
push ebx
push ebx
push offset WndProc
push ebx
push esp
call _imp__RegisterClassA@4
        push ebx    
push esi
push ebx
push ebx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
push WS_OVERLAPPEDWINDOW + WS_VISIBLE
push edi; szWinTitle
push edi; lpszClassName
push ebx
call _imp__CreateWindowExA@48
mov ebp,esp
message_loop: push ebx 
push ebx
push ebx
push ebp
call _imp__GetMessageA@16
        cmp [ebp+MSG.wParam],1Bh;press "Esc"?
jz wmDESTROY
push ebp
call _imp__DispatchMessageA@4     ;return control to Windows       
jmp short message_loop
WndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
local ps:PAINTSTRUCT
local hdc:dword
local hOldBmp:dword
local hGDITmp:dword
local hOldDIB:dword
local hBackDC:dword
local hMainDIB:dword
local bufBMP:dword

mov eax,uMsg
        dec eax;cmp eax,WM_CREATE
jz wmCREATE
        dec eax;cmp eax,WM_DESTROY
jz wmDESTROY
        sub eax,WM_PAINT-WM_DESTROY
jz wmPAINT
leave
jmp _imp__DefWindowProcA@16

wmDESTROY::push hOldBmp
push hBackDC
call _imp__SelectObject@8
mov hGDITmp, eax
push bufBMP
call _imp__DeleteObject@4
push hBackDC
call _imp__DeleteDC@4
push hOldDIB
push bufDIBDC
call _imp__SelectObject@8
mov hGDITmp,eax
push bufDIBDC
call _imp__DeleteDC@4
push hMainDIB
call _imp__DeleteObject@4
push hWnd
call _imp__DestroyWindow@4
push ebx ; nExitCode
call _imp__ExitProcess@4

wmCREATE:push hWnd
call _imp__GetDC@4
mov hdc, eax
        push eax ; HDC
call _imp__CreateCompatibleDC@4
mov bufDIBDC,eax

push ebx
push ebx
push offset pMainDIB
push ebx;DIB_RGB_COLORS
push offset bi
push hdc
        call _imp__CreateDIBSection@24
mov hMainDIB,eax
push eax; hMainDIB
push bufDIBDC
call _imp__SelectObject@8
        mov eax,hOldDIB
push hdc
push hWnd         
        call _imp__ReleaseDC@8;   // Libera device context         
;Initialization
;Create Paleta---------------------------------
  ; Verde normal
mov miPaleta[2*4].Azul,23h
mov miPaleta[2*4].Verde,0ADh
mov miPaleta[2*4].Rojo,30h
  ; Marrуn
mov miPaleta[6*4].Azul,0Bh
mov miPaleta[6*4].Verde,1Dh
mov miPaleta[6*4].Rojo,3Fh
  ; Verde oscuro
mov miPaleta[8*4].Azul,2Dh
mov miPaleta[8*4].Verde,77h
mov miPaleta[8*4].Rojo,11h
  ; Verde claro
mov miPaleta[10*4].Azul,88h
mov miPaleta[10*4].Verde,0FFh
mov miPaleta[10*4].Rojo,9Ch
;------------------------------------------------
push 150
push 270
push cdYSize-1
push (cdXSize/2)
call Fractal_Tree
jmp wmBYE

wmPAINT:lea eax,ps
push eax
push hWnd
call _imp__BeginPaint@8
push SRCCOPY
push ebx;0
push ebx;0
push bufDIBDC
push cdYSize
push cdXSize
push ebx;0
push ebx;0
push eax;hdc
call _imp__BitBlt@36
lea eax,ps
push eax
push hWnd
        call _imp__EndPaint@8
wmBYE:  ret
WndProc endp
Fractal_Tree proc x:dword,y:dword,angle:dword,len:dword

local color:dword
local u1:dword
local a1:dword
local p:dword
local i:dword
local y1:dword
local x1:dword

cmp len, 5
jl locret_402029
fild angle
fmul deg2rad
fsincos
fimul len
fiadd x
fistp x1             ; x1 = x + len * cos(angle*deg2rad)
fimul len
fiadd y
fistp y1 ; y1 = y + len * sin(angle*deg2rad)
cmp len,95         ; if (len > 95)
jle @f
mov p, 95          ;p = 95
jmp loc_4019C1
@@: mov eax, len       ;else p = len;
mov p, eax
loc_4019C1: mov eax, p
mov ecx, 5
cdq
idiv ecx
mov ecx, offset mColores[0]
add ecx, eax
movzx eax, byte ptr [ecx]
mov i, eax         ;i = mColores[p/5]
call _imp__rand
and eax,1          ;if ((rand() % 2) == 0) {
jnz setcolor
mov eax, i
cmp al,mColores[0] ;if (i == mColores[0])
jnz @f
movzx eax, byte ptr mColores[1]
mov i, eax         ;i = mColores[1]
jmp setcolor
@@: mov eax,i          ;else
cmp al,mColores[1] ;if (i == mColores[1])
jnz setcolor
movzx eax,mColores[0];i = mColores[0]
mov i, eax
setcolor: mov eax,i
lea edx,miPaleta[eax*4].Rojo
movzx ecx,byte ptr [edx]
shl ecx,16
                lea edx,miPaleta[eax*4].Verde
mov ch,[edx]
                lea edx,miPaleta[eax*4].Azul
mov cl,[edx]
                mov color,ecx;color = miPaleta[i].Azul + (miPaleta[i].Verde<<8) + (miPaleta[i].Rojo<<16)
;mov eax, i
cmp al,mColores[0]
jz @f
cmp al,mColores[1]
jnz loc_401B65;if ( (i == mColores[0]) || (i == mColores[1]) ) {
@@: mov i,ebx
loc_401AA0: cmp i,c3         ;for (i = 0; i <= c3; i++) {
ja loc_401C47
mov eax, x
add eax,i
sub eax,1
mov u1,eax      ;u1 = x+i-c3/2
cmp eax,cdXSize
jae @f
cmp y,cdYSize
jae @f
cmp x1,cdXSize
jae @f
cmp y1,cdYSize
jae @f          ;if (u1 < cdXSize && u1 > 0 && y < cdYSize && y > 0 && x1 < cdXSize && x1 > 0 && y1 < cdYSize && y1 > 0)
push color
push y1
push x1
push y
push u1
call DIBLine     ;DIBLine (u1,y,x1,y1, color, pMainDIB)
@@: inc i
jmp short loc_401AA0
;} else {
loc_401B65: mov i,ebx   ;for (i = 0; i <= p/c2; i++) {
loc_401B6D: mov eax, p
mov ecx, c2
cdq
idiv ecx
cmp i, eax
ja loc_401C47
mov eax, x
add eax, i
push eax
mov eax, p
mov ecx,c2*2; 12
cdq
idiv ecx
pop ecx
sub ecx, eax
mov u1, ecx   ;u1 = x+i-p/(c2*2)
cmp u1,cdXSize
jae @f
cmp y,cdYSize
jae @f
cmp x1,cdXSize
jae @f
cmp y1,cdYSize
jae @f       ;if (u1 < cdXSize && u1 > 0 && y < cdYSize && y > 0 && x1 < cdXSize && x1 > 0 && y1 < cdYSize && y1 > 0)
push color
push y1
push x1
push y
push u1
call DIBLine  ;DIBLine (u1,y,x1,y1, color, pMainDIB)
@@: inc i
jmp loc_401B6D
loc_401C47: mov i,ebx     ;for (i = 0; i <= 3 - (rand()%3); i++) {
loc_401C4F: call _imp__rand
mov ecx, c3
cdq
idiv ecx
mov eax, c3
sub eax, edx
cmp i, eax
jg locret_402029
call _imp__rand
push eax
mov eax, len
mov ecx, c2
cdq
idiv ecx
mov ecx, len
sub ecx, eax
pop eax
cdq
idiv ecx
mov eax, len
mov ecx, c2
push edx
cdq
idiv ecx
pop ecx
add ecx, eax
mov p, ecx ;p = rand() % (len - len / 6) + len / 6
call _imp__rand
mov ecx,55
cdq
idiv ecx
mov eax, angle
sub eax, edx
mov a1, eax;a1 = angle - (rand() % 55)
fild angle
fmul deg2rad
fsincos
fimul p
fiadd x
fistp x1 ; x1 = x + p * cos(angle*deg2rad)
fimul p
fiadd y
fistp y1 ; y1 = y + p * sin(angle*deg2rad)
mov eax, len
cmp eax,100
jle @f;loc_401DFB   ;if (len > 100)
call _imp__rand
mov ecx,15
cdq
idiv ecx
mov eax,100
jmp a2
@@: call _imp__rand
mov ecx,15
cdq
idiv ecx
mov eax, len
a2: sub eax, edx
sub eax,c1
push eax
call _imp__rand
mov ecx,c1
cdq
idiv ecx
pop eax
add eax, edx
push eax
push a1
push y1
push x1
call Fractal_Tree ;Fractal_Tree(x1,y1,a1,100-(rand()%15)-c1+(rand()%c1))
loc_401E40: call _imp__rand
push eax
mov eax, len
mov ecx, c2
cdq
idiv ecx
mov ecx, len
sub ecx, eax
pop eax
cdq
idiv ecx
mov eax, len
mov ecx, c2
push edx
cdq
idiv ecx
pop ecx
add ecx, eax
mov p, ecx
call _imp__rand
mov ecx,55
cdq
idiv ecx
mov eax, angle
add eax, edx
mov a1, eax
;----------------------------------------------------------------
fild angle
fmul deg2rad
fsincos
fimul p
fiadd x
fistp x1 ; x1 = x + p * cos(angle*deg2rad)
fimul p
fiadd y
fistp y1         ; y1 = y + p * sin(angle*deg2rad)
;-----------------------------------------------------------------
call _imp__rand
cmp len, 100 ; if (len > 100)
jle @f
mov ecx,15
cdq
idiv ecx
mov eax, 100; Fractal_Tree(x1,y1,a1,100-(rand()%15)-c1+(rand()%c1));
jmp a0
@@: mov ecx, 15
cdq
idiv ecx
mov eax, len
a0: sub eax, edx
sub eax,c1
push eax
call _imp__rand
mov ecx,c1
cdq
idiv ecx
pop eax
add eax, edx
push eax
push a1
push y1
push x1
call Fractal_Tree ; Fractal_Tree(x1,y1,a1,len-(rand()%15)-c1+(rand()%c1));
inc i
jmp loc_401C4F
locret_402029: leave
retn 10h
Fractal_Tree endp
;----------------------------------------------
DIBLine proc u1:dword,y:dword,x1:dword,y1:dword,color:dword

local var_1C:dword
local var_18:dword
local var_14:dword
local var_10:dword
local var_C:dword
local var_8:dword
local var_4:dword


mov eax,y
cmp eax,y1
jnz @f

push color
push x1
push y
push u1
call sub_401121
jmp exit
@@: mov eax, u1
cmp eax, x1
jnz @f
push color
push y1
push y
push u1
call sub_4011A8
jmp exit
@@: mov eax, x1
sub eax, u1
mov var_4, eax
cmp eax, ebx
jge @f
neg var_4
@@: mov eax, y1
sub eax, y
mov var_8, eax
cmp eax, ebx
jge @f
neg var_8
@@: mov eax, u1
cmp x1,eax
sbb ecx,ecx
or ecx,1
mov var_C,ecx
mov eax, y
cmp y1,eax
sbb ecx,ecx
or ecx,1
mov var_10,ecx
mov eax, var_4
sub eax, var_8
mov var_14, eax
loc_401334:     mov ecx, y
shl ecx, 7
mov eax, ecx
shl eax, 2
add eax, ecx
add eax, u1
mov var_1C, eax
shl eax, 2
mov ecx, pMainDIB
add ecx, eax
mov eax, color
mov [ecx], eax
mov eax, u1
cmp eax, x1
jnz @f
mov eax, y
cmp eax, y1
jz exit
@@: mov eax, var_14
shl eax, 1
mov var_18, eax
xor eax,eax
sub eax, var_8
cmp var_18, eax
jle @f
mov eax, var_14
sub eax, var_8
mov var_14, eax
mov eax, u1
add eax, var_C
mov u1, eax
@@: mov eax, u1
cmp eax, x1
jnz @f
mov eax, y
cmp eax, y1
jnz @f
mov ecx, y
shl ecx, 7
mov eax, ecx
shl eax, 2
add eax, ecx
add eax, u1
mov var_1C, eax
shl eax, 2
mov ecx, pMainDIB
add ecx, eax
mov eax, color
mov [ecx], eax
jmp exit
@@: mov eax, var_18
cmp eax, var_4
jge loc_401334
mov eax, var_4
add var_14,eax
mov eax,var_10
add y,eax
jmp loc_401334

exit: ret
DIBLine endp
;----------------------------------------------------------------------
sub_401121 proc u1:dword,y:dword,x1:dword,color:dword

local var_8:dword
local var_4:dword

mov eax, u1
cmp eax, x1
jle @f
lea eax, x1
push eax
lea eax, u1
push eax
call sub_401000
@@: mov ecx, y
shl ecx, 7
                mov eax, ecx
shl eax, 2
add eax, ecx
add eax, u1
mov var_8,eax
mov var_4,ebx
@@: mov eax, x1
sub eax, u1
cmp var_4, eax
jg @f
mov eax, var_8
add eax,var_4
mov ecx, pMainDIB
lea ecx,[ecx+eax*4]
mov eax, color
mov [ecx], eax
inc var_4
jmp @b
@@: leave
retn 10h
sub_401121 endp
;----------------------------------------------------------------------
sub_4011A8 proc u1:dword,y:dword,y1:dword,color:dword
local var_8:dword
local var_4:dword

mov eax,y
cmp eax,y1
jle @f
lea eax,y1
push eax
lea eax,y
push eax
call sub_401000
@@: mov ecx,y
shl ecx,7
mov eax,ecx
shl eax,2
add eax,ecx
mov ecx,u1
add eax,ecx
mov var_8,eax
mov var_4,ebx
@@: mov eax,y1
sub eax,y
cmp var_4,eax
jg @f
mov eax,var_8
mov ecx,pMainDIB
lea ecx,[ecx+eax*4]
mov eax,color
mov [ecx],eax
add var_8,cdXSize
inc var_4
jmp @b
@@: leave
retn 10h
sub_4011A8 endp
;---------------------------------------------------------------------
sub_401000 proc arg_0:dword,arg_4:dword
local var_4:dword

mov eax, arg_0
mov ecx, [eax]
mov var_4, ecx
mov eax, arg_0
mov ecx, arg_4
mov edx, [ecx]
mov [eax], edx
mov eax, arg_4
mov ecx, var_4
mov [eax], ecx
leave
retn 8
sub_401000 endp
;----------------------------------------------------------------------
.data
miPaleta stPaleta <0>,<0>,<0>,<0>,<0>,<0>,<0>,<0>,<0>,<0>,<0>
wTitle db "Fractal Tree - (c) abreojosensamblador.net",0
bi BITMAPINFOHEADER <sizeof BITMAPINFOHEADER,cdXSize,-cdYSize,1,32,0>
bufDIBDC dd ?
pMainDIB dd 0
mColores db 2,10,10,8,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,6
deg2rad dq 0.01745329251994329576923690768
end start
bat-file
Code: [Select]
cls
set filename=FTreeWM01
if exist %filename%.exe del %filename%.exe
if exist %filename%.com del %filename%.com
if exist %filename%.dll del %filename%.dll
set masm_path=c:\masm32
if exist %filename%.rc (
%masm_path%\bin\rc /v %1.rc
%masm_path%\bin\cvtres /machine:ix86 %1.res
%masm_path%\bin\ml /c /Cp /Gz /I%masm_path%\include /coff /nologo %filename%.asm  || exit
%masm_path%\bin\link /SUBSYSTEM:WINDOWS  ^
/LIBPATH:%masm_path%\lib /NOLOGO  %1.obj %filename%.res || exit
del %filename%.res
) else (
%masm_path%\bin\ml /c /Cp /Gz /I%masm_path%\include /coff /nologo %filename%.asm  || exit
%masm_path%\bin\PoLink /SUBSYSTEM:WINDOWS  ^
/LIBPATH:%masm_path%\lib /NOLOGO %filename%.obj
)
if exist %filename%.map del %filename%.map
if exist %filename%.obj del %filename%.obj
if exist %filename%.ilc del %filename%.ilc
if exist %filename%.ild del %filename%.ild
if exist %filename%.ilf del %filename%.ilf
if exist %filename%.ils del %filename%.ils
if exist %filename%.tds del %filename%.tds
exit

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
Re: AOW32
« Reply #12 on: November 02, 2015, 09:19:56 PM »
Qué tal, Mikl__. Da la sensación de que tu forma de trabajo es desensamblar el fichero exe y trabajar sobre el código resultante, el resultado es un código ilegible. No es necesario, tienes las bibliotecas accesibles.

Ahora, tu método de desensamblaje es encomiable, algún día me podrías enseñar cómo lo haces, estoy muy interesado  :t.
En un lugar de la Mancha de cuyo nombre no quiero acordarme

Mikl__

  • Member
  • ****
  • Posts: 550
Re: AOW32
« Reply #13 on: November 03, 2015, 11:12:25 AM »
Hola Alonso!
En AOW32 no son los original asm-files ("Fern Leaf Fractal" y "Fractal Tree") o la biblioteca "CDIBLines.h." Por lo tanto es necesario desensamblar el fichero exe, comparar con el  texto del C-file, escribir los comentarios, elimina el exceso (KilTimer hay, pero SetTimer no hay) etcétera

Mikl__

  • Member
  • ****
  • Posts: 550
Re: AOW32
« Reply #14 on: November 09, 2015, 11:28:58 AM »
Fractal de Julia
asm-file
Code: [Select]
; masm windows gui #
.686
.model flat
includelib user32.lib
includelib kernel32.lib
includelib gdi32.lib
extern _imp__BeginPaint@8:dword
extern _imp__BitBlt@36:dword
extern _imp__CreateWindowExA@48:dword
extern _imp__CreateCompatibleDC@4:dword
extern _imp__CreateDIBSection@24:dword
extern _imp__DefWindowProcA@16:dword
extern _imp__DispatchMessageA@4:dword
extern _imp__DeleteObject@4:dword
extern _imp__DeleteDC@4:dword
extern _imp__DestroyWindow@4:dword
extern _imp__EndPaint@8:dword
extern _imp__ExitProcess@4:dword
extern _imp__GetDC@4:dword
extern _imp__GetMessageA@16:dword
extern _imp__RegisterClassA@4:dword
extern _imp__ReleaseDC@8:dword
extern _imp__SelectObject@8:dword

cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 440
cdXSize         equ 640 ;cdYSize*1.6
DIB_RGB_COLORS  equ 0
cdNumColores    equ 256
cdMaxIterac     equ 256

VK_ESCAPE                            equ 1Bh
WM_CREATE                            equ 1h
WM_DESTROY                           equ 2h
WM_PAINT                             equ 0Fh
SRCCOPY                              equ 0CC0020h
BITMAPINFOHEADER STRUCT
  biSize            DWORD      ?
  biWidth           DWORD      ?
  biHeight          DWORD      ?
  biPlanes          WORD       ?
  biBitCount        WORD       ?
  biCompression     DWORD      ?
  biSizeImage       DWORD      ?
  biXPelsPerMeter   DWORD      ?
  biYPelsPerMeter   DWORD      ?
  biClrUsed         DWORD      ?
  biClrImportant    DWORD      ?
BITMAPINFOHEADER ENDS
stPaleta struct
  Azul db ?
  Verde db ?
  Rojo db ?
  Alfa db ?
stPaleta ends
RECT STRUCT
  left    dd      ?
  top     dd      ?
  right   dd      ?
  bottom  dd      ?
RECT ENDS
POINT STRUCT
  x  DWORD ?
  y  DWORD ?
POINT ENDS
PAINTSTRUCT STRUCT
  hdc           DWORD      ?
  fErase        DWORD      ?
  rcPaint       RECT       <>
  fRestore      DWORD      ?
  fIncUpdate    DWORD      ?
  rgbReserved   BYTE 32 dup(?)
PAINTSTRUCT ENDS
MSG STRUCT
  hwnd      DWORD      ?
  message   DWORD      ?
  wParam    DWORD      ?
  lParam    DWORD      ?
  time      DWORD      ?
  pt        POINT      <>
MSG ENDS
BLACK_PEN                            equ 7
WS_VISIBLE                           equ 10000000h
.code
start: xor ebx,ebx
        mov edi,offset wTitle
        mov esi,400000h
push edi
push ebx
push BLACK_PEN
push 10011h
push ebx
push esi
push ebx
push ebx
push offset WndProc
push ebx
push esp
call _imp__RegisterClassA@4
        push ebx    
push esi
push ebx
push ebx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
push WS_VISIBLE;+ WS_OVERLAPPEDWINDOW
push edi; szWinTitle
push edi; lpszClassName
push ebx
call _imp__CreateWindowExA@48
mov ebp,esp
message_loop: push ebx  ;цикл обработки сообщений
push ebx
push ebx
push ebp
call _imp__GetMessageA@16
        cmp [ebp+MSG.wParam],VK_ESCAPE;press "Esc"?
jz wmDESTROY
push ebp
call _imp__DispatchMessageA@4     ;вернуть управление Windows       
jmp short message_loop
;------------------------------------------------------------
WndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
local ps:PAINTSTRUCT
local hdc:dword
local hOldDIB:dword
local hMainDIB:dword
local bufBMP:dword
local n:dword
local m:dword
local x:qword
local y:qword
local u:qword
local v:qword

mov eax,uMsg
        dec eax;cmp eax,WM_CREATE
jz wmCREATE
        dec eax;cmp eax,WM_DESTROY
jz wmDESTROY
        sub eax,WM_PAINT-WM_DESTROY
jz wmPAINT
leave
jmp _imp__DefWindowProcA@16

wmDESTROY::push bufBMP
call _imp__DeleteObject@4
push hOldDIB
push bufDIBDC
call _imp__SelectObject@8
push bufDIBDC
call _imp__DeleteDC@4
push hMainDIB
call _imp__DeleteObject@4
push hWnd
call _imp__DestroyWindow@4
push ebx ; nExitCode
call _imp__ExitProcess@4
wmPAINT:lea eax,ps
push eax
push hWnd
call _imp__BeginPaint@8
push SRCCOPY
push ebx;0
push ebx;0
push bufDIBDC
push cdYSize
push cdXSize
push ebx;0
push ebx;0
push eax;hdc
call _imp__BitBlt@36
lea eax,ps
push eax
push hWnd
        call _imp__EndPaint@8
        jmp wmBYE
wmCREATE:push hWnd
call _imp__GetDC@4
mov hdc, eax
        push eax ; HDC
call _imp__CreateCompatibleDC@4
mov bufDIBDC,eax

push ebx
push ebx
push offset pMainDIB
push ebx;DIB_RGB_COLORS
push offset bi
push hdc
        call _imp__CreateDIBSection@24
mov hMainDIB,eax
push eax; hMainDIB
push bufDIBDC
call _imp__SelectObject@8
        mov eax,hOldDIB
push hdc
push hWnd         
        call _imp__ReleaseDC@8;   // Libera device context         
;Initialization
;Creat Paleta---------------------------------
mov eax,cdNumColores - 31
mov ecx,16
mov dl,240
@@: mov miPaleta[eax*4].Verde,dl
sub dl,16
mov miPaleta[eax*4].Rojo,0FCh
        inc eax
loop @b
mov ecx,16
mov dl,240
@@: mov miPaleta[eax*4].Rojo,dl
sub dl,16
inc eax
loop @b
;Creat Fractal------------------------------------------------
mov n,cdYSize
        fld const4
a0: mov m,cdXSize
a1: fild m
fdiv const160
fsub const2
fstp x ; x = m /(cdXSize/4.0) - 2.0
fld1
fild n
fdiv const200
fsubrp st(1),st
fstp y ; y = n /(cdYSize/2.0) - 1.0
mov ecx,cdMaxIterac
@@: fld x
fmul st,st
fld y
fmul st,st
fsubp st(1),st
fadd cfReal
fstp u ; u = x*x - y*y + cfReal
fld x
fmul y
fadd st,st
fadd cfImaginario ; v = 2*x*y + cfImaginario
fstp v
fld u
fst x ; x = u
fmul st,st
fld v
fst y ; y = v
        fmul st,st
faddp st(1),st
fucomp                  ; if (u*u+v*v > 4.0) break;
fnstsw ax
test ah,01000101y ;45h
loopnz @b ; for (i = cdMaxIterac; i >= 1; i--) {
movzx eax,miPaleta[ecx*4].Rojo
shl eax,16
mov ah,miPaleta[ecx*4].Verde
mov al,miPaleta[ecx*4].Azul; eax = miPaleta[Color].Azul + (miPaleta[Color].Verde << 8 ) + (miPaleta[Color].Rojo<<16);
mov edx,n
dec edx
imul edx,cdXSize
add edx,m
dec edx
shl edx,2
add edx,pMainDIB
mov [edx],eax ; *(pMainDIB + (n-1)*cdXSize+m-1) = c; //0xFFBBCC
dec m
jnz a1  ; for (m = cdXSize; m >= 1; m--) {
dec n   ; for (n = cdYSize; n >= 1; n--) {
jnz a0
wmBYE:  ret
WndProc endp
;----------------------------------------------------------------------
.data
miPaleta stPaleta 256 dup (<0>)
wTitle db "Fractal de Julia - (c) abreojosensamblador.net",0
bi BITMAPINFOHEADER <sizeof BITMAPINFOHEADER,cdXSize,-cdYSize,1,32,0>
bufDIBDC dd ?
pMainDIB dd ?
const2 dd 2.0
const160 dd 160.0
const200 dd 200.0
const4 dd 4.0
cfReal          dd 0.3
cfImaginario dd -0.5
end start
bat-file
Code: [Select]
cls
set filename=JuliaWM01
if exist %filename%.exe del %filename%.exe
set masm_path=c:\masm32
%masm_path%\bin\ml /c /Cp /Gz /I%masm_path%\include /coff /nologo %filename%.asm  || exit
%masm_path%\bin\link /SUBSYSTEM:WINDOWS  /LIBPATH:%masm_path%\lib /NOLOGO %filename%.obj
del %filename%.obj
exit