By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

Equivilent of unsigned char x[65535]; ?

P: n/a
Hello. I plan to write a 6502 emulator using PHP.

One thing I'd need is to to store 64k as the RAM. I suppose I could use an
a PHP array, with integers 0..65535 as the index, but as the PHP is an
associative array, it doesn't seem like the best storage.

Another possibility could be to keep a 64k long string. Could PHP handle
such a long string, including all possible byte values includind 0 and 255
and everything inbetween?

Perhaps there's a way to access a raw buffer of memory which I can't find
in the documents.

Any ideas please?

Bill, why yes, I am quite mad!
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Bill Godfrey" <bi**********@sunny-coventry.invalid> wrote in message
news:20*******************@newsreader.com...
Hello. I plan to write a 6502 emulator using PHP.

One thing I'd need is to to store 64k as the RAM. I suppose I could use an
a PHP array, with integers 0..65535 as the index, but as the PHP is an
associative array, it doesn't seem like the best storage.

Another possibility could be to keep a 64k long string. Could PHP handle
such a long string, including all possible byte values includind 0 and 255
and everything inbetween?


Yes, with no problem at all. I regularly use multi-megabyte strings.

The preferred syntax of access a character within a string is $x{3445}. To
get the actual byte value you need to use ord().
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.