On May 18, 10:57am in "Re: Weekly ramble...", you warbled:
] That reminds me of a great theory I had. Which was to treat the entire screen
] as one incredibly big binary number, and constantly add 1 to it. Doing this
] you'd eventually display every possible screen for the Sam, some of which
would
] be incredibly good, and possibly inspire me for a game.
]
] However, there are quite a few possibilitys, and to go through them all
] would take a very long time. Nice Idea though (if you follow what I meant!)
]
] Tim ....@/
]
] (128*192+32)*8 combinations I think. (number of bits making up a screen)
Ummmmmmm.... wrong.
You mean 128*192*256... which is 6291456...
] at 1 screen per second thats
] 3281 minutes
104857...
] 54.68 hours
1747...
] 2.27 days.
72...
(rounding here, cos I'm using dc and can't be bothered to approximate... )
] And you'd have to watch every screen, some of which would be very dull.
Very...
] I think those figures are right, anyone want to write the code to do it?
Hmmmm... quite simple.
Skipping the paging parts, assuming you have code at 16384-32767 and screen
at 32768-65535, and ROM0 at 0-16383....
loop1:
ld b,50 ; this will sometimes give slightly more than a second,
; cos the code below will take some time to execute
halt ; interrupts must be enabled. If you like, you could
; replace this with a scan-line check
djnz $-1
ld hl,32768
ld a,(hl) ; see below
inc a ; see below
ld (hl),a ; see below...
jr nc, loop1
ld bc,24576
loop3:
inc hl
ld a,(hl) ;
inc a ;
ld (hl),a ; ditto
jr nc, loop1
dec bc
ld a,b
or c
jr nz, loop3
;bc has got to 0 -- hit the end of the screen...
;now if (hl)=0, it's finished...
ld a,(hl)
or a
ret z
jr loop1
Before anyone mentions, yes, I probably should have stored 32768 in de, and
reloaded that _only_ after it had changed... and I _probably_ should have used
inc (hl) but I can't for the _life_ of me remember if it changes the C flag
and I don't have my databook to hand...
However, I _think_ this would do what you want...
PS. I'm wearing my flame-proof suit today... :) :)
Geoff