# How 6502 Overflow Works

The 6502 was a ubiquitous microprocessor back in the 80s, powering devices such as the Apple II and the Nintendo Entertainment System. [Ken] took an in depth look at a small part of the processor: the overflow circuit.

In order to do signed calculations, a microprocessor’s arithmetic logic unit (ALU) needs to be able to calculate when an overflow occurs. This happens when two numbers are added that cannot fit in a single byte. The result of a calculation will be incorrect, so the processor must inform the program that an overflow has occurred. This is done by setting an overflow flag.

[Ken] uses this example to first explain how the overflow circuit works in logic. He then looks at the gates and a transistor implementation of the logic. Finally, he walks us through the circuit on the actual 6502 die, showing how the circuit is constructed in silicon.

This is a great example to learn a bit more about how ALUs work and how integrated circuits get built.

# Evolutionary Algorithms Computes The Best Blackjack Strategy

Don’t want to learn about evolutionary algorithms the usual way, by generating sentences from random letters, or randomly placing pixels to generate the Mona Lisa? Then make your own evolutionary algorithm! With blackjack!

[Brian] has been playing around with evolutionary algorithms, and wanted a task that’s well suited for optimization. He chose blackjack, because of the limited number of hands that can be dealt to the player (32) and low number of hands the dealer can have (10).

Even with the low number of initial conditions for the player and the dealer, there are still 4.562 x 10^192 possible combinations of hands, so brute forcing a blackjack strategy would require the computational power of the entire planet. An easier way to compute a good strategy is an evolutionary algorithm, implemented by [Brian] with the Watchmaker Java library.

For each generation in [Brian]’s program, a 32×10 grid was generated, one cell each for possible player’s hands against the dealer’s hand. In each cell, the computer put a ‘hit’, ‘stay’, or ‘double down’, and played thousands of hands with that strategy. The best strategies were bred and eventually [Brian] ended up with a good blackjack strategy.

The resulting best strategy is pretty good – using his strategy, he can walk out of an Atlantic City casino with 96% of the money he arrived with.

What looks to be a stock brick Game Boy with two additional buttons is actually one of the coolest portable mods we’ve ever seen.

Instead of the classic 1989 hardware, the interior of this Game Boy is stuffed with a Dingoo A330 portable emulation machine capable of playing Game Boy, Game Boy Advance, and other 8 and 16-bit console classics.

After a great deal of modification to the original Game Boy enclosure, [Alex] cut down two Game Boy PCBs to wire the D pad, A, B, select and start buttons to the Dingoo. An extra pair of buttons were added and the shoulder buttons present on the Dingoo were emulated with rocker switches placed where the original volume and contrast controls were.

All this and a new color LCD (and screen bezel) means this Game Boy looks nearly stock, save for the addition of an extra pair of buttons. It’s a fabulous piece of work, and we’re exceedingly jealous for [Alex]’s friend receiving this for his birthday.

You can check out this build in action after the break.

# 3D Printing Vacuum Tube Sockets

With the popularity of 3D printers and the current cult of vacuum tubes, it’s shocking we haven’t seen someone do this before.

[Peter] printed his own sockets for a few vacuum tubes he had lying around. After designing them on his computer, [Peter] printed them out on his local hackerspace’s 3D printer.

After printing out the plastic parts, [Peter] needed to add a few strips of metal for a conductor. He used a few pieces of an ATX power supply; a little difficult to fit, but something that works all the same.

So far, [Peter] has whipped up a few sockets for UX5 and VT76 tubes, UX6, B7G (7 pin mini), and B9D  Magnoval tubes. No Nixie sockets yet, but it’s enough diversity to build your own tube amp using the most common designs. Now if we could only make our own transformers with laser cutters and 3D printers…

# Automating A Key Fob Camera For Time Lapse

If you’re lofting a digital camera high into the stratosphere with a helium balloon, you really can’t do better than one of those key fob spy cameras. Being extremely lightweight with decent resolution, they’re the perfect camera to take to near space. If you’re bringing someone along to snap the pictures, that is.

[Román] wanted to take his 808 spy camera to new heights, but not wanting to manually reset the thing when it’s 100,000 feet in the air decided to use a microcontroller instead. An 8-pin PIC12F675 takes care of taking 60 pictures with a 4-second interval, then switching to movie mode and recording a 20-second video.

The entire device can be powered by 6 to 9 volts with the help of a voltage regulator. [Román] found the camera hangs after taking about 1600 photos, so a connection from the microcontroller to the reset switch was added. Everything works on the ground, so we can’t wait to see what happens miles above the Earth’s surface.