Page 1 of 1

XMS

Posted: Sat Jun 27, 2009 10:05 am
by Yazar
Hi! I was creating a library for QB4.5. But when I tried to add XMS commands to library, I detected that, writing single byte to that memory doesn't work with xms copy function. I found a way but, now I need to know if there is a direct way to write/read single byte to/from xms memory ? If you answer this, I'd be pleased very much...

P.S. I call the XMS API with the right sub functions. When the amount of work bytes set to 1, it just don't work. So, I use 2 bytes operations, first read the target byte into AL and the next byte into the AH, then change the target byte in AL and save AX to the transfer area. As you can see for a single byte operation, a lot of work is done!

Any solutions ?

XMS / EMS SOLUTION

Posted: Tue Jun 30, 2009 8:35 am
by Kiyotewolf
I don't have it handy, but I have a complete ""use XMS (or was it EMS) for dummies reference program that is a re-write from a normal example that doesn't take into account that QB doesn't like the Segment switched between SUB and FUNCTION calls.

You have to wrap your operations of the XMS or EMS I/O in a DEF FN statement, because the routine is being called from the main area of the program, and it doesn't push stuff into the pointers and crap.

If you try to put I/O (read & writes) of EMS & XMS in a SUB or FUNCTION and expect it to work, you will end up in the stillborn area of coding that people in QBASIC have been suffering with for YEARS.

Put a DEF FN wrapper around the code that actually access the XMS and EMS directly, then call that DEF FN from a SUB, then you can branch out from there.

If you do not, you will find your code works for a couple CPU cylces, then it falters and fails.

If you do put it in a DEF FN wrapper, you will find it does in fact work. Something in the blood of QBasic doesn't like to let you do EMS and XMS functions directly from SUB's or FUNCTION's.

I figure that to save on memory, some part of the pointer it uses gets jumbled up, because the interpreter/compiler thinks you don't have access to XMS and EMS functions.

Little did they know we QBasic'ers love to do things all wrong.



Ok.

It's not code, but it's how to do it.

If you really want code, reply to this msg again and ask for it.

I will upload it to a 2-wk. available download link that will expire 14 days after I post it on this forum.



Kiyote!