My Atmel AVR

Last wednesday in my ASM and Systems Programming class we received our STK500 programming boards for use with our projects. Yesterday we were given some taste of how to program a board in Atmel ASM.

The ‘official’ way to download your program to an atmel board is to use their Windows-only AVR Studio. Boo!

Luckily, there is Linux software already available for this. AVRDUDE lets you communicate with the STK500 programmer to download code compiled into the Intel Hex format. Finding a compiler is a bit more difficult, but still pretty easy. There isn’t a compiler in the fedora repos, so I went searching and found avra. It is 100% compatible with the official AVR compiler.

As my first free time project, I made some leds count in binary:


;comment
.cseg
.org 0
.def count = r16
.def temp = r17
.equ PORTB = 0x18
.equ DDRB = 0x17
ldi temp,0xFF
out DDRB,temp
ldi count,0x00

lp:
out PORTB,count
inc count
rjmp lp

That was pretty thrilling for me, but I wanted more, so I made a pattern expand outwards:


;comment
.device ATmega16
.cseg
.org 0
.def output = r16
.def temp = r18
.equ PORTB = 0x18
.equ DDRB = 0x17
.equ LEFT = 0b11110000
.equ RIGHT = 0b00001111
.equ PATTERN = 0b00011000

ldi temp,0xFF
out DDRB,temp
ldi output,PATTERN

lp:
out PORTB,output
mov temp,output
andi output,LEFT
lsl output
andi temp,RIGHT
lsr temp
or output,temp
ldi temp,0
cpse temp,output
rjmp lp
ldi output,PATTERN
rjmp lp

And here’s the device in its blinking glory:

Comments »

Windows Vista BCD Recovery

Apparently I’m not all that up to speed on Windows Vista, specifically, its boot process. Then again, my only experience with it is occasionally fixing my girlfriend’s wireless connection to my university’s secure network (I add that NetworkManager for both my Fedora laptops works automagically. Hooray Linux!).

She had been getting fed up with Vista’s incompatibilities and proprietary formats, so I offered to install Kubuntu on it using the Wubi Installer. It installed, rebooted, did the first-boot install/setup of the OS, and rebooted again to Vista’s boot selector so I could finally run Kubuntu. The boot sequence went right along up until it got to showing GDM. Nothing came up, so I figured it was some random first-run bug. Rebooting it greeted me with an error from the Vista bootloader that the file \Boot\BCD was not found and that booting could not continue.

Oops.

Windows Vista has a slightly different boot system than all previous versions of Windows. Vista is the first edition of the NT Kernel that can boot on an EFI motheboard, so the bootloader had to be rewritten. Instead of boot.ini, the Vista bootloader loads a file called ‘BCD’ which holds the boot configuration data. The BCD is used by both the BIOS and EFI Vista bootloader. I don’t have any experience with EFI yet, so I can’t say much about what makes it so different they had to rewrite this. The main thing though is that this BCD file replaced boot.ini.

The BCD is stored in the same binary format as the registry, so you can’t really boot into a Linux live CD and fix it. Somehow Kubuntu screwed me over and my girlfriend was pissed. After a bit of searching, I discovered that the only two ways to fix the BCD was to use Vista’s internal tool or a Vista install disk’s recovery tool. The first was out of the question, and since it was an HP laptop, so was the second.

I started searching for pirated copies of the Vista install disk, and found a legal solution from, of all people, Microsoft. NeoSmart has a copy of Microsoft’s official download. The file is an .iso image you burn to a disk, and it contains the entire Vista installer program, without Vista. All thats left after you take out the OS from the installer is the repair and recovery tools. Handy stuff, that.

Comments »

Quiffle Anti-spam upgraded

For anyone keeping tabs on quiffle, spam posts per day has recently peaked at around 50. It makes loading the admin panel after a week of inactivity take forever because I didn’t bother adding paging. My “Clean Spam” button is at the bottom of the page, which means it is neigh impossible to clean the spam.

So now spam is detected more accurately using similar techniques as done on the pastebin, and my control panel tab has an extra tab dedicated to Quiffle spam. After seven days, spam quotes get dropped off of the face of the earth. I think that gives ample time to anyone concerned about the “Your quote has been tagged as spam” message to react. If not, it must not’ve been that funny of a quote anyways.

Comments »

Safari, the Red-Headed Stepchild of Browsers

With the recent release of Safari on Windows, I thought it’d be nice for me to reiterate my ideas about the Browser Wars. For my everyday browsing, I use Konqueror on Linux and Opera on Windows. Right now, there are herds of firefox fans foaming at the mouth because of my previously vehement pro-firefox stance. Then I realized that it doesn’t really matter and people should be free to choose. When I set up my aunt’s new computer, the first thing I did was to install firefox and opera. I didn’t forage through the control panel to totally disallow access to IE. No, that would be stupid. Its her computer, so why should I care which one she uses? I only care that she knows there are others out there. No browser is perfect. No, not even Firefox, Safari, Opera, IE, or even Konqueror. They each have their own quirks and attitudes. (more…)

Comments »

Why Nubs are Better than Touchpads

After watching Discovery Channel’s special on bionics, I discovered the reason why I can’t stand the touchpads that most laptops have. The program mentioned how the brain adapts and integrates with whatever we interact with. An example would be a tennis player. They don’t swing the racket. They use it as though it was an extension of their body. This is much the same way that I use a mouse. I don’t think about where to move the mouse, I just think where I want the cursor to go, and my brain interprets that intention appropriately. It moves the muscles in my arm to move the mouse, which moves the cursor as I want it. If you don’t believe me, try changing your mouse speed. If you slow it down, it seems like it takes great effort to move the cursor, doesn’t it?

This effect seems to apply only to things directly connected to my body. A nub requires my finger to stay in the same position as I move the mouse. A touchpad forces my finger to move until it hits the edge of the pad, then I must break that continuous motion to return my finger to a starting position. With the nub, the finger simply keeps pushing in that direction until the position is achieved. When moving your arm out in front of you, do you move it like a ratchet wrench?

Comments »

New Computer

My PVR box is finally built. I got the CPU, RAM, and HD in the mail a few days ago. I’ll have some more info about it later once I take some pictures of it. Already I’ve found some flaws in my plan. I’m using my ATI All-In-Wonder VE capture card that I’ve had since about 2000, and the audio is very tinny, like a Game Boy. Also, the onboard graphics doesn’t have Xvideo support.

Comments »

How to Dual Boot Fedora and Windows XP

Actually, any distro of linux that allows you to install to empty space on a HD, without disturbing the rest of the drive would work. But Fedora seems to have the most user-friendly installer around.

Tools Needed

Partitioning

First, if it makes you feel more secure, go ahead and backup your important files. Stick in your knoppix/gparted disk and reboot.

These instructions work for both QTParted and GParted. In knoppix, Open up a root terminal, and type qtparted. In GParted’s LiveCD, GParted should be displayed already. Select your harddisk and right click on the big box that says NTFS. Select “Resize”, and cut it in half. Click the save icon in the upper left corner to apply the changes. When you click this, the program resizes the NTFS filesystem (moves fragmented files closer together, etc), and then partitions your disk, giving it an NTFS partition, and a blank one.

Filesystem Check

Now, reboot your computer, and take out the CD when linux tells you to, leaving it aside. If you are using the GParted cd, right-click the ‘desktop’ after closing out GParted. Eject the CD then just power-cycle the box. You can dispose of it, or erase the CD if you want now. When windows boots up, it’ll say it is checking the integrity of the filesystem, and other useless pap. Let it run through this. When you log into windows, go to My Computer, and look! You now have a C: drive that is 50% smaller!

Installing Fedora

Make your fedora CDs (I make 2 of each, as I tend to accidentally scratch them often), put Disk 1 into the drive, and reboot. Configure it as you want. Tell it to install everything to the free space. When you get the option, install the bootloader to the Master Boot Record. After all this is done, reboot, and you’ll see the GRUB boot loader. Let it go for a bit, and you are now booting Fedora.

Rebooting into windows

After the initial configuration of Fedora, restart your computer. When you get to the GRUB bootloader screen again, push any key, then select Other and hit enter. You are now booting windows.

Comments »