Page 1 of 1

playing Tower of Hanoi with registers

Posted: Fri Oct 20, 2006 1:38 am
by AndrewAPrice
My registers were always mixed up when ever I returned from my screen printing functions. I checked my printing function over and over again, but nothing appeared to be wrong. My solution was to 'call tower_of_hanoi' after each print, a function that would play an interesting game of Tower of Hanoi and re-arrange my registers in the correct order.

I soon found out all of this wasn't required, because of some sillyness in the 'pop'ing and 'push'ing of the registers in my printing function:

Code: Select all

print:
        push    edi
        push    eax
        push    ebx

; more code here
        pop     eax
        pop     edi
        pop     ebx
        ret
Moral of the story: if your registers are screwed, save yourself a lot of headache by checking your 'pop'ing and 'push'ing!

Posted: Fri Oct 20, 2006 2:14 am
by spix
That's pretty funny.

"Sorry, your computer is busy playing games and doesn't have time for you. It might beable to fit you in on friday. Thursday is D&D night with the modem and printer. OK CANCEL"

Well, I thought it was funny ;)