Friday, August 9, 2013

Learning assembly in my spare moments

The system:
Sparcstation 10 with a single 36 MHz Supersparc CPU and 16 MB RAM. OpenBSD 4.5 on a 1 GB hard disk. 

With this meager system I am learning about being efficient with my resources and learning assembly in order to still do something useful with the machine. The default OpenBSD install comes with their custom gcc compiler and perl 5.10. Perl runs very slow on this machine making CPAN use impossible without an upgrade. But through SSH I can comfortably write small programs to assist with my solutions to Project Euler. After installing GMP I can really get into number theory with the little box.

But the real fun comes with learning Sparc V8 assembly language. I'm finally at the point in assembly where I can modify the examples I read to do other things. And I used gdb for the first time too.

I'm already dreaming up of a way to translate one set of assembly instructions to another using perl. :-)

So what have I learned so far? Well I learned that every Sparc assembly file starts with a stack initialization. So you start with:
save %sp,-96,%sp

Sunday, August 4, 2013

Fun times at Project Euler.

Felt like I needed to exercise my brain the other day so I went over to Project Euler to solve a few problems. It was problem #4. I tried to solve it on an old 3B2 computer running Unix System V with Perl 4.0. It didn't go too well. So I ran the same code on my MetaArpa account on SDF and solved the thing in less than a minute ha ha. I like the old system though because it forces me to realize just how bad my algorithms are when the site states that all problems should take less than a minute to solve with a normal computer. Fun day.