davidad / 8queens Goto Github PK
View Code? Open in Web Editor NEWx64 assembler solution to n-queens problem. Not tested for n!=8.
x64 assembler solution to n-queens problem. Not tested for n!=8.
I'm not sure how to sort out the nasm autoinstall crap, so I just ran this instead:
nasm 8queens.asm -o 8queens.o -f elf64 && ld -o 8queens 8queens.o
Anyway, the syscalls are different. FreeBSD uses 1 for exit, and 4 for write. Calling convention for 64-bit x86 is identical to Linux, or at least close enough for 8queens to work.
Do not be an idiot like I was and blindly go "ok, 2 means write". It means fork. Yeah, I accidentally forkbombed myself. Fortunately, the process limit was reached and it stopped, or something like that.
With that said, support should be pretty easy.
EDIT: Also, exit() appears to return something else. rdi is the correct register, but it appears that r8 is getting mangled somewhere.
EDIT 2: -DNOPRETTY returns the correct value of 92. push r8/pop r8 around the write() syscalls results in values which are randomly larger, about 105 or something.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.