.486
.model small
extrn __turboFloat:near
extrn __setargv:near
public _main
_TEXT segment
_main:
push ebx
push esi
push edi
push ebp
mov ebp,esp
sub esp,4
mov dword ptr -4[ebp],0
L2:
mov edi,dword ptr -4[ebp]
lea edi,[edi*4]
mov dword ptr _down[edi],1
mov dword ptr _up[edi],1
L3:
inc dword ptr -4[ebp]
cmp dword ptr -4[ebp],15
jl L2
mov dword ptr -4[ebp],0
L6:
mov edi,dword ptr -4[ebp]
mov dword ptr _rows[edi*4],1
L7:
inc dword ptr -4[ebp]
cmp dword ptr -4[ebp],8
jl L6
push 0
call _queens
add esp,4
mov eax,0
L1:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
public _queens
_queens:
push ebx
push esi
push edi
push ebp
mov ebp,esp
sub esp,4
mov dword ptr -4[ebp],0
L13:
mov edi,dword ptr -4[ebp]
cmp dword ptr _rows[edi*4],0
je L17
mov esi,dword ptr 20[ebp]
mov ebx,edi
sub ebx,esi
cmp dword ptr _up+28[ebx*4],0
je L17
lea edi,[esi][edi]
cmp dword ptr _down[edi*4],0
je L17
mov edi,dword ptr -4[ebp]
mov esi,dword ptr 20[ebp]
lea ebx,[esi][edi]
mov dword ptr _down[ebx*4],0
mov ebx,edi
sub ebx,esi
mov dword ptr _up+28[ebx*4],0
mov dword ptr _rows[edi*4],0
mov edi,dword ptr 20[ebp]
mov esi,dword ptr -4[ebp]
mov dword ptr _x[edi*4],esi
cmp dword ptr 20[ebp],7
jne L21
call _print
add esp,0
jmp L22
L21:
mov edi,dword ptr 20[ebp]
lea edi,1[edi]
push edi
call _queens
add esp,4
L22:
mov edi,dword ptr -4[ebp]
mov esi,dword ptr 20[ebp]
lea ebx,[esi][edi]
mov dword ptr _down[ebx*4],1
mov ebx,edi
sub ebx,esi
mov dword ptr _up+28[ebx*4],1
mov dword ptr _rows[edi*4],1
L17:
L14:
inc dword ptr -4[ebp]
cmp dword ptr -4[ebp],8
jl L13
L12:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
public _print
_print:
push ebx
push esi
push edi
push ebp
mov ebp,esp
sub esp,4
mov dword ptr -4[ebp],0
L37:
mov edi,dword ptr -4[ebp]
mov edi,dword ptr _x[edi*4]
lea edi,49[edi]
push edi
lea edi,L41
push edi
call _printf
add esp,8
L38:
inc dword ptr -4[ebp]
cmp dword ptr -4[ebp],8
jl L37
lea edi,L42
push edi
call _printf
add esp,4
L36:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
_TEXT ends
extrn _printf:near
_TEXT segment
_TEXT ends
_DATA segment
public _x
align 4
_x label byte
db 32 dup (0)
public _rows
align 4
_rows label byte
db 32 dup (0)
public _down
align 4
_down label byte
db 60 dup (0)
public _up
align 4
_up label byte
db 60 dup (0)
_DATA ends
_DATA segment
align 1
L42 label byte
db 10
db 0
align 1
L41 label byte
db 37
db 99
db 32
db 0
_DATA ends
end
