<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 25 Nov 2009 01:30:04 -0000
From   : jumbos.bazzar@... (Mark Haysman)
Subject: Quine

> Think of it using "the traditional metaphor": It's a big stack of
> dishes, all piled up. You can put dishes on top, you can take off the
> top dish. You can't pull out dishes from elsewhere in the stack, or
> crockery will get broken and wife/girlfriend/mom/nosy-biddy-next-door
> will shout.

That's not strictly true, you can use some trickery to pull something off 
the stack that's not in order:

TSX
INX
LDA&101,X

will read the second item from the stack, and not the top item.

   10P%=&3000
   20[
   30LDA#5:PHA:LDA#10:PHA
   40TSX
   50INX
   60LDA&101,X
   70STA&4000
   80PLA:PLA
   90RTS
  100]
  110CALL&3000
  120PRINT?&4000

You could then go on to write a short routine that moved all the items in 
the stack so it would equal a pull, rather than a read, if that's what you 
wanted to do. Just would need to be careful with your return addresses.

Mark.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>