Page 1 of 2

Breaking the barrier

Posted: Fri Nov 26, 2004 3:29 pm
by {Nathan}
I have a thery that from my meager research can be proven to break the 640kb barrier that limits us, but I need a very expierenced and knowledgeable asm programmer to help me. I put the clues together: windows breaks the barrier. That's a big duh. But... when windows 95/98 start up... what do you see? DOS! That got me figuring, windows breaks the barrier, and, well, I have this hex editor that reads the hex code and converts it to asm, so therefor I could send it to an expeirenced asm programmer, look at window's code and BREAK THE BARRIER!!! Prove me right, everyone (or wronge)! I NEED HELP, THOUGH!!!

Posted: Fri Nov 26, 2004 4:12 pm
by Nodtveidt
Umm...it's not exactly a big secret...putting the processor in flat mode is absurdly easy. :D Also, protected mode DOS is also very easy to do. QB is not suited for either task, although I think it was v1ctor who was able to do it already anyways. In any event, freeBASIC already "breaks the barrier". :D

Posted: Fri Nov 26, 2004 5:01 pm
by MystikShadows
What's the status on FreeBasic anyways? I've been trying to find that out on qbasicnews, but there's so much freebasic stuff scattered all over the forum I'm not sure where to go to know what's going on ;-).

Anyone here can clearly clue me in on the latest and greatest of FreeBasic?

Posted: Fri Nov 26, 2004 6:02 pm
by Nodtveidt
From what I understand, v1ctor's still hard at work on the compiler, aetherFox and I will be making the IDE for it shortly, marzecTM and a few others are continuing to write new library conversions.

Posted: Fri Nov 26, 2004 7:18 pm
by MystikShadows
Did you get my PM on qbasic news? if not pay a visit to the forum dude :-)...

Posted: Fri Nov 26, 2004 7:43 pm
by Z!re
Basic4Gigabytes by v1ctor

B4G for short..

32bit lib for QB

Posted: Fri Nov 26, 2004 8:26 pm
by MystikShadows
has anyone worked with it B4G that is?

reason i'm asking is i'd like to know more about it. For instance, how does the transfer in and from memory work? how do i declare an array of more tham 640kb? is it all invisible to us? is there certain types of data types only that can be sent to and from the flat memory model? can I declare an array of UDT's and it automatically send it to where there's place? or do I have to transer something to and from?

How do I use it? do I just include a BI file? did anyone use it so far and could send me some good examples? Email side of course? at srichard@adaworld.com

Anyone? :-)

B4G -small tut.

Posted: Sat Nov 27, 2004 6:35 am
by Vongodric.
I do work with it.
And you can get even 10mb if you want. However working with it is a bit different then with qb's. You can read and write into that memory: bytes(not in qb, but is equal to one byte STRING*1-is the closest), integers, longs, singles, doubles and strings -oh also udt(user defined types) here's small example:
before anything you need to start the basic with b4g:

Code: Select all

qb /l b4g.qlb 'for qb4.5
qbx /l b4gx.qlb 'for qbx 7.1
qbv /l b4gv.qlb 'for vbdos
and then add '$include: 'b4g.bi' in the beginning of your code.
first let's allocate some memory:
all identifiers must be of long type!

Code: Select all

Size&=&h100000   'that's 1MB 'the size we're gonna use.
buffer&=&h10000    'that's 64k buffer for mapped memory (is a lot faster)
xblk& = xmalloc(Size&)   'allocate memory
Map& = xmapmake(Buffer&) 'make a buffer.
xmap xblk&, Memory&, Map& 'create a memory map.
Before to proceed we need to check if initalisation was successful:

Code: Select all

 IF (xblk& = 0) OR (Map& = 0) THEN
	 PRINT "Not enough memory!"
	 CLOSE
	 EXIT FUNCTION
 END IF
Now that this is done we can read/write data in it.
to read a byte:

Code: Select all

 byte% = xMapPeekB(xMap, offset&)
NB! you need to know the location from where to read that byte. Also location is LONG type as well to write byte to the memory is almost same, but

Code: Select all

xMapPokeB(xMap, offset&, value%)
the same way works

Code: Select all

iInt% = xMapPeekI(xMap, offset&) 'integer
iLong& = xMapPeekL(xMap, offset&) 'long
iSingle! = xMapPeekS(xMap, offset&) 'Single
iDouble# = xMapPeekD(xMap, offset&) 'double
and their opposites:

Code: Select all

xPokeI(xMap, offset&,iInt%) 'integer
xMapPokeL(xMap, offset&,iLong&) 'long
xMapPokeS(xMap, offset&,iSingle!) 'Single
xMapPokeD(xMap, offset&,iDouble#) 'double
Strings are a bit different, becouse you also need to know the lenght of teh string. But to write a string, you can just go as before:

Code: Select all

 xMapPokeStr(xMap, offset&, text$)
, but to read string back you need to specify the lenght(it is useful to get the size of the string before you push it to the memory, a=len(text$), so to read:

Code: Select all

Text$=xMapPeekStr$(xMap, Offset&, Stringlenght%)
Using UDT's: Once you have one you can also push it to the memory and read it back later, of course memory locations is smth you need always to know, so:

Code: Select all

TYPE blabla
   i as integer
   x as string*10
   y as long
end type
dim udt as blabla
xMapPokeT(xMap, Offset&, udt, len(udt)) 'pushes content of udt to memory.
len(udt) gives the size in bytes of the UDT. now to read it back:

Code: Select all

 xMapPeekT(xMap, Offset&, udt, len(udt))
Note that xMapPeekT is NOT a function. also the name udt, must be predefined with dim statament. To test, if it works you can for example null it's values before returning it from memory.
Note then when exiting you need to deinit it

Code: Select all

xmfree Script(i).xblk
b4gdone
Anyway this is short introduction to b4g, it's not as easy as qb's memory handling is, but it's powerful. In one memory container you can store anything you like, even write as integers, and read as string from the same location -that can be fun. There's no restriction's about what you read/write as long as you are inside the memory limit.

Posted: Sat Nov 27, 2004 6:42 am
by vongodric
Sry, there are few mistakes, I mostly ripped the code from my prjc.
one, if is mapped memory then:
xMapPokeI(xMap, offset&,iInt%) '<---integer
xMapPokeL(xMap, offset&,iLong&) 'long
xMapPokeS(xMap, offset&,iSingle!) 'Single
xMapPokeD(xMap, offset&,iDouble#) 'double
also exiting you need to xblk <-the name you used all along, not script(i)...

Hope it's useful.

Posted: Sat Nov 27, 2004 2:30 pm
by MystikShadows
so then I initalize everything,

Use xMapPoke____ (where ____ is the data type I want to storee). to store everything I need.

I assume I do that in a loop for an array?

And then I could use xMapPeek____ (datatype) to read them back? into what? a variable of the valid type I presume?

Then I unintialize everyhting I initialized at the end to restore things the way the were...and I'm done?

Posted: Sat Nov 27, 2004 4:19 pm
by Z!re
And you must remember to init, and clsoe b4g.. MUST! remember..

You also MUST remember to free your memory when you close the program...

MUST MUST MUST!

Re: Breaking the barrier

Posted: Sun Nov 28, 2004 12:59 am
by barok
Nathan1993 wrote:I have a thery that from my meager research can be proven to break the 640kb barrier that limits us, but I need a very expierenced and knowledgeable asm programmer to help me. I put the clues together: windows breaks the barrier. That's a big duh. But... when windows 95/98 start up... what do you see? DOS! That got me figuring, windows breaks the barrier, and, well, I have this hex editor that reads the hex code and converts it to asm, so therefor I could send it to an expeirenced asm programmer, look at window's code and BREAK THE BARRIER!!! Prove me right, everyone (or wronge)! I NEED HELP, THOUGH!!!
eh? ever heard of ems and xms?

Posted: Sun Nov 28, 2004 8:11 am
by {Nathan}
Hmm... well, can we access the 3D functions of the video card? That was my main goal all along, to access the functions.

Posted: Sun Nov 28, 2004 10:03 am
by Z!re
Nope, you cant


Sorry...

Posted: Sun Nov 28, 2004 11:15 am
by {Nathan}
Well... that is my goal :D It hasn't been done yet!

Posted: Sun Nov 28, 2004 12:05 pm
by Z!re
Each GFX card uses its own version of ASM to communicate with the card itself...

The card is mapped on 4gb+ memory, which is unaccessible by QB, as QB can only handle 32bit integers max (32bit = 4gb)


Almost no manufacturer release their cards specifications so you can make your own drivers.
To prevent from malicious use of their cards..


In other words, their cards have sucky error handling and can be abused to fry your computer... they don't want the lawsuits...

simple...



Anyways, wait for FreeBASIC, or move on to VB with DX... sadly, it's the only thing you can do...


I have wanted to do what you're talkinga bout, did lots of research.. but it's not possible... sadly...

Posted: Sun Nov 28, 2004 2:59 pm
by {Nathan}
:( that sucks. I have moved on to VB though, but it's graphic stuff sucks so I don't use it, though I did make a journal program with it... that sucks really bad (didn't know about OPEN AS APPEND for a long time through the project :( ) and what the heck is VX?

PS. VB sucks

Posted: Sun Nov 28, 2004 4:00 pm
by Z!re
VX?


DX Is DirectX


And yes, VB does suck... unless you really know how to use it.. which i dont... :P..

Posted: Sun Nov 28, 2004 4:08 pm
by MystikShadows
I could teach you :-)......

Been programming in VB since it first came out for windows 12 years ago ;-)

Oh GAWD!!!! that's not helping my hiding my age here...lol....Nek? we really that damn old???

I better call my bank and have them STOP the payments on those reality checks....LOL

Posted: Sun Nov 28, 2004 4:49 pm
by {Nathan}
VB sucks. Peroid. AMEN!!!

Also, someone should find out how to use Direct X in qb.