Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIMing

Status
Not open for further replies.

KenshinHimura

Programmer
May 8, 2003
91
US
I need some help i need too DIM an array that has a 65535 subscript. Is there any possible way too pass the usual DIMing limit (32676 I think it is)?
 
Nope, I'm wrong, sorry about that. Why do you need to go up to 65535, becuase the only way to do it would be by using single byte strings DIM a(65535) AS STRING * 1, it takes up the same memory as a%(32676), but each block is half as big.
 
You see I'm making an NES library. The registers are 8-bit, but the memory addresses are 16-bit and thus in qbasic I needed to make a simulation of all of the NES memory addresses which would make it up to 65535 and i figured that it was possible because integers in qbasic are 16-bit I thought there was maybe someway to do it if i could make it unsigned. I was testing using the /ah and '$DYNAMIC hoping i could get that high, but couldn't. But when i was experimenting i was wondering why DIM memaddress(0 to 319, 0 to 199) worked yet Dim memaddress(64000) didn't. Although thats not what i need. Is there anyway to make it unsigned so that that it will go from 0 to 65535 instead of -32768 to 32767. I was looking through the qbasic help file and found that constant integer decimals are signed so they have the optional of being - or +, but Hexadecimal numbers are unsigned. Does that work the same with non constants? Thx for your help so far. :)
 
Nintendo Entertainment System? Classic, some things are better in the original. Snake Rattle and Roll is the best game ever.
So anyway, you could use an XMS or EMS library, or you can look at the FAQ called "how can I get more conventional memory".
 
Yeah, the Nintendo Entertainment System. I thought making a would make NES programming easier, but then i decided that I should sort of have a simulation of it so that while I'm programming I can run it and see how it'll turn out before I compile it into an NES file. I've heard of ems and xms what exactly does it do? Well thx for your help I'll go look up EMS and XMS. :)
 
I'd guess it's too late for my reply to be of much help, but if the EMS/XMS thing doesn't pan out (and for me it rarely did-- I hated it! :) ), you could always go the slightly slower route and use a set of wrapper functions to get two arrays to work like one.

Example:

dim array1(32767)
dim array2(32767)

sub setArray(element as long, value as integer)
if element > 32767 then
array2(element - 32767) = value
else
array1(element) = value
end if
end sub

function getArray%(element as long, value as integer)
if element > 32767 then
getArray% = array2(element - 32767)
else
getArray% = array1(element)
end if
end function





...like I said, a bit slow, but if the XMS/EMS thing turns out to be more trouble than it's worth, it's a possibility. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top