[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: killing time in 6502 assembly



pg@sff.net (Paul Guertin) writes:
>It could be interesting to try to come up with 6502 "busy beavers".
>A busy beaver is a program that eventually terminates (in other words,
>it doesn't enter an infinite loop). The idea is to come up with the
>program of length N that works for the longest time before terminating.
>To preserve the theoretical flavor of the problem, assume 64k of RAM
>and no ROM routines to call.

Treat almost all RAM as a very long binary number, the rest is the program.
Increment that number from 000..000 to 111..111. When it wraps stop.
Assuming that the code increments approx every 10us and we have a 500000
bit number, the time to run would be of the order of 10^150000 seconds.
As there are only about 10^7 seconds in a year, I have no intention of
running such a program.

P.S. I had to use logs to work this out - probably the first time since
high school.
--
David Wilson  School of IT & CS, Uni of Wollongong, Australia  david@uow.edu.au