Skip to main content

Posts

Showing posts with the label assembly

BootChess: The Tiniest Chess Program in Town

Coding hyper-efficient chess programs has been something like a running contest among big time Smarty Pantses with too much time on their hands. For the last 33 years, the record for the smallest version of chess was held by the fabled 1K ZX Chess for the Sinclair ZX81. First published in 1982, 1K ZX had all of the basic chess rules and a opponent loaded into a now-hard-to-imagine 672 bytes of memory. Its publisher, David Horne , would go on to publish the code for the program in a three art Computer Magazine series (the first part of which you can see embedded below: This is the super-rad David Horne: 1K ZX's 33 year reign has just been challenged. The challenger is a program called BootChess, which includes all of the features of 1K ZX with a stunning memory allocation of only 512 bytes. The program was written by  Olivier Poudade and Peter Ferrie . It was never a very graphic-intensive game, anyway This is a photo of Peter Ferrie: A photo of Olivier Po

C Programming Tutorial Part 1 - Compiling C using clang

Part 1 of our C Programming Tutorial covers the basics of compiling. What is a compiler? How does it work? How do I use a compiler to write programs in C? Every application that you write in C will have to be compiled. Furthermore, compilation errors and failures will be your first indication that you have made a mistake in your program somewhere. Understanding your compiler in and out will help you to write code much more efficiently.  For the purposes of our tutorial today, we will be discussing the clang compiler . clang is widely used - iOS developers should recognize it as the compiler used for developing iPhone apps as part of xCode and Apple's LLVM . I will also use a number of demonstrations; these demonstrations will include source code written in C, assembler and some garbage ASCII that is representative of machine code viewed through a text editor. For my part, I am using a Fedora Linux virtual machine for these demonstrations. That said, as I discussed initial