mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-24 13:11:30 +00:00
176 lines
2.6 KiB
Text
Executable file
176 lines
2.6 KiB
Text
Executable file
.486
|
|
.model flat
|
|
extrn __fltused:near
|
|
extrn __ftol: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
|
|
L11:
|
|
mov edi,dword ptr (-4)[ebp]
|
|
cmp dword ptr (_rows)[edi*4],0
|
|
je L15
|
|
mov esi,dword ptr (20)[ebp]
|
|
mov ebx,edi
|
|
sub ebx,esi
|
|
cmp dword ptr (_up+28)[ebx*4],0
|
|
je L15
|
|
lea edi,[esi][edi]
|
|
cmp dword ptr (_down)[edi*4],0
|
|
je L15
|
|
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 L19
|
|
call _print
|
|
add esp,0
|
|
jmp L20
|
|
L19:
|
|
mov edi,dword ptr (20)[ebp]
|
|
lea edi,(1)[edi]
|
|
push edi
|
|
call _queens
|
|
add esp,4
|
|
L20:
|
|
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
|
|
L15:
|
|
L12:
|
|
inc dword ptr (-4)[ebp]
|
|
cmp dword ptr (-4)[ebp],8
|
|
jl L11
|
|
mov eax,0
|
|
L10:
|
|
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
|
|
L23:
|
|
mov edi,dword ptr (-4)[ebp]
|
|
mov edi,dword ptr (_x)[edi*4]
|
|
lea edi,(49)[edi]
|
|
push edi
|
|
lea edi,(L27)
|
|
push edi
|
|
call _printf
|
|
add esp,8
|
|
L24:
|
|
inc dword ptr (-4)[ebp]
|
|
cmp dword ptr (-4)[ebp],8
|
|
jl L23
|
|
lea edi,(L28)
|
|
push edi
|
|
call _printf
|
|
add esp,4
|
|
mov eax,0
|
|
L22:
|
|
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
|
|
_TEXT segment
|
|
align 1
|
|
L28 label byte
|
|
db 10
|
|
db 0
|
|
align 1
|
|
L27 label byte
|
|
db 37
|
|
db 99
|
|
db 32
|
|
db 0
|
|
_TEXT ends
|
|
end
|