Qbasicnews.com

Full Version: weird problem I've never seen before - need help/testing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I've written a library that allows you to allocate and copy to/from blocks if protected mode memory (via DPMI). All the library functions switch to protected mode, do whatever they do, then switch back to real mode.

I was calling the library functions from an asm program, and it was working perfectly. But when I use the lib in QB, it seems to work fine, but then when I quit QB, I get something like this:
Code:
Memory allocation error - cannot load COMMAND.COM
I doubt it's Window' fault, I've got XP pro, I take good care of it and it's always been stable.

I would post the source code, but it's 10kb. You can download the project with source code here

EDIT: I just tried it again - no error this time! But I didn't change anything - what's going on? Does it work on your computer?
Code:
Checking DPMI support: DPMI host found!
Number of paragraphs required: 3
Initializing: Initialized successfully!
Sterling  Christensen

Works fine for me. Running XP Pro.
I have the same results as Plasma357. No errors come up. I'm using Win98.

- Dav
That means that it's corrupting memory. Either that or it's allocating all the memory and not returning it. But it's more likely that it's corrupting memory.
I tried making it copy 256 bytes instead of 21 (I allocated 1024), and now the program causes an illegal instruction error message windows to pop up, either that or it just returns to the command prompt with no explanation.

Quote:That means that it's corrupting memory. Either that or it's allocating all the memory and not returning it. But it's more likely that it's corrupting memory.
I think you're right, but riddle me this: why does it corrupt memory when called from QB, but work perfectly every time when called from from a simple asm program?

The only differences I can think of is that QB uses the single-step interrupt for debugging - I disable that before going into protected, of course... Is there anything else that QB does that I might not have accounted for?
(sorry about the double post)

I know I'm missing something here, but what it is is beyond me.

It looks like I would need in depth knowledge of QB's working, and real mode debugging environments in general to make this work properly with QB. This is also the first time I've ever played with DPMI... I don't know what I'm doing.

I'm sorry to say this, but I'm going to drop it. There will be no DPMI gfx lib.

To anyone who was interested: I'm sorry.
having a nice text file with a list of possible asm commands to use for the tokens in the compiler is good, too. Smile
Yeah, I'm still working on the compiler, occasionally.
Quote:having a nice text file with a list of possible asm commands to use for the tokens in the compiler is good, too.
I'm not really sure what you mean. The tokens in programs written for my compiler will be quickbasic syntax tokens, like "AND", "OPEN", ">=", etc. not asm tokens...
Well, a really flexible compiler could go from quickbasic syntax to your own special syntax that is easily convertible to machine code/ASM to machine code/ ASM itself. Smile
I say why not ditch QB and make a QB-Like lang in Pmode? That would be coolness redefined.

;*)
Pages: 1 2