Home | Reviews | GUIpedia | Forum | Fun500


ikonguiUnreal mode for scripts
I was wondering if anyone has thought of doing this? Setup unreal mode so you can access up to 4gb of memory. Then store the program scripts above lower memory. You could have a huge amount of scripts running, and all of lower memory would be free for whatever resources QB needs. Setting up unreal mode is very easy. All that would need to be done is write a few simple routines: A routine to copy the script files contents to an upper memory block. A routine to read a line back from the memory block to a QB string. And a very simple memory manager to keep track of which blocks area allocated. Heck, you could probably do this with one of the XMS libs out there. So has someone done this before?
2009-01-2712:55 PM

ToddRe:Unreal mode for scripts
I know QB Object and G-Control by AMP Software use EMS/XMS libraries but it can be really annoying since EMS/XMS is somewhat touchy on my computers. So you'd be left with 1 of 2 choices: resources or compatibility.
2009-01-273:41 PM

BrandonRe:Unreal mode for scripts
Well, I use FreeBASIC and it lets me use as much RAM as I want, my GUI uses like 8MB or so of RAM average. FB uses CWSDMPI.
2009-01-274:02 PM

trollyRe:Unreal mode for scripts
i'm no sure if you speak about protected mode, if it is, i must say that it's not so simple, to use protected mode in dos you must also create a protected mode GDT (global descriptor table) with all used segment (moslty 2 or 3 in flat memory model (1 for the code segment, 1 for the data segment and the stack segment), segmentation is not the same in Pmode as in realmode (in realmode a segment register refers to a memory address, in protected mode, the segment register is the entry of the segment in the GDT with the memory attribution (run level, executable, readable, writable, etc...) and if you want to use system services (like os interrupt, driver request ,etc...) you must go back to the real mode because interrupt vector (idt) from realmode and protected mode are not the same i'm affray byt qbasic can not run in this mode (freebasic can do it but with CWSDPMI and an very huge overhead) for the memory allocation, it's fairly simple: memory can be splitted in fixed size blocs (4kb is a good choice) and you use a bitmap table to know witch block are free. for allocating a number of blocs, you must just look the table for contiguous free blocs(values 0), set the bloc as "used"(value 1) and the las block as "last block"(value 2) and you return the memory adress of the first block ((first_bloc_num * blocsize)+start_of_allocation_space) to free a bloc chain from an address, you convert the addres to a bloc number ((address - start_of_allocation_space)/blocsize) and you mark all blocs to "free" (value 0) until you find the "last block" (value 0)
2009-01-278:14 PM

ikonguiRe:Unreal mode for scripts
Unreal mode isn't protected mode. Unreal mode is accomplished by opening the a20 gate, then setting up a gdt for say fs and gs selectors. You still run in 16bit mode but you leave the fs and gs selectors alone so you can use them with 32bit offets.. eg: mov ebx,0x100000 mov al,'a' mov fs:[ebx],al This is what I did in the first operating system I wrote. It was/is capable of running simple dos programs and it gives access to 4gb of memory, plus all the usual bios interrupts.
2009-01-279:35 PM

trollyRe:Unreal mode for scripts
ok, thank you for this info ^^ i did' not know the existence of a such operating mode ^^
2009-01-279:46 PM

ToddRe:Unreal mode for scripts
A little off-topic, does anyone know where I can find a manual with all the interrupts and what they do? I'm trying to learn a little Assembler.
2009-01-289:40 AM

trollyRe:Unreal mode for scripts
hardware interrupt or software interrupt? for sofwtare interrupt under dos, it's int 10h for bios services and int 21h for dos services google is your friend
2009-01-2810:19 AM

ikonguiRe:Unreal mode for scripts
Ralf Brown's list is IMO the best. http://www.ctyme.com/rbrown.htm
2009-01-2811:32 AM

ToddRe:Unreal mode for scripts
Ralph Brown's site, yes! I remember seeing it on DJGPP's site. I've still got a long ways to go. I'll probably try to read an Assembler tutorial or two over the week and weekend and play around with Flat Assembler a little bit.
2009-01-282:10 PM

SonicBritRe:Unreal mode for scripts
Yeah the Ralf Brown list is great a little overwhelming though, most of the time you'll want to use int 21h for all your services unless you need more control over text and/or graphics in which case you'll want use use 10h, or direct access to the hardware. (Using 21h for text output guarantees that it will get redirected if need be)
2009-01-286:11 PM

pharoahRe:Unreal mode for scripts
Wait, what does this allow me to do? Could I use unreal mode to multitask DOS programs without too much difficulty?
2009-01-304:35 PM

SonicBritRe:Unreal mode for scripts
no unreal mode is a method to trick the hardware into giving you access to the full 4gb or however much ram the system has. Basically you would launch protect mode and then drop back to real mode, it does not however give you access to multitasking and whatnot since the processor is back in 16-bit mode. This method is also called flat mode (you might find it listed under that). I'm sure if you wrote a kernel you would be able to do some sort of task switching but it would require some tricky code to do it.
2009-01-308:01 PM

GUIs


2021 Brandon Cornell