Home | Reviews | GUIpedia | Forum | Fun500


SonicBritMulti Tasking using Quick Basic
I dont know if any of you have done this before, but quick basic does include a method to multitask if you compile the exe into a BRUN type. You can share memory between apps using Common Shared instead of DIM and you can load apps by using Chain "appname" Attached is a demo, run mcp It first checks to see if there is a key press, if its esc it will exit. If this program is first run it clears the screen It will then run prog1 or prog2, depending on the value of prog. Prog1 and Prog2 display the time in a different place on the screen, and change the variable prog to the other one. You could build a GUI this way, but you would need to use some sort of event system. Basically the Master Control Program would handle the events (keypress, mousemove), then depending which window was active it would receive the event posted to its que and then called. It would also be a benefit if the MCP also did the drawing rather than requiring each app to handle the drawing, it would just need to know about the what windows there are (which would be in the shared memory), basically you would make a .bi include file that would have all the needed types (windows, controls etc..) Then have a main loop in each app that handles what happens to that app, but wouldn't be responsible for actually updating the display, the MCP would handle that. I'll work on a GUI demo to show the concept. [file name=multi.zip size=62423]http://theguiblog.com/images/fbfiles/files/multi.zip[/file]
2009-08-048:17 PM

BrandonRe:Multi Tasking using Quick Basic
I didn't know you could use common shared like that. I can't wait for your GUI example. I'd advise saving the code as text, for people like me without QB all set up to study code.
2009-08-048:29 PM

ToddRe:Multi Tasking using Quick Basic
It's a neat concept but the problem is multithreading processes such as ones within loops. For example, if prog1 loops and does 3 things in the loop, and prog2 does as well, processing prog1 and prog2 threads by doing one at a time. TSRs were one way to do it but they are somewhat difficult to do. The best way I imagined a task swapper was to have a program that can unload a program from RAM into a hard drive file and vice versa.
2009-08-0410:34 PM

BrandonRe:Multi Tasking using Quick Basic
[quote]RAM into a hard drive file and vice versa[/quote]I don't know as I like that, I mean RAM is RAM and a hard drive is a hard drive. The difference: RAM is faster and has no moving parts (less likely to fail), a hard drive is slow and they tend to be unreliable in real DOS machines (like 486s). A RAM disk would be a good idea, but all the ones that I have found require being in config.sys and can't just be SHELLed from a GUI Core. But you could, do like Todd said, but like Sonicbrit said have some COMMON SHARED variables that contain what would have been saved to the hard drive in Todds plan. I can't wait to see how Sonicbrit's example works out, though.
2009-08-0410:49 PM

Re:Multi Tasking using Quick Basic
[quote]I don't know as I like that, I mean RAM is RAM and a hard drive is a hard drive. The difference: RAM is faster and has no moving parts (less likely to fail), a hard drive is slow and they tend to be unreliable in real DOS machines (like 486s). A RAM disk would be a good idea, but all the ones that I have found require being in config.sys and can't just be SHELLed from a GUI Core.[/quote] http://wiki.osdev.org/Unreal_Mode http://www.freedos.org/cgi-bin/lsm.cgi?mode=lsm&lsm=devel/frm-lib.lsm Maybe this will let you access more ram then the less then 640kb right from real mode in qbasic
2009-08-0911:25 PM

BASIC Programming Help


2021 Brandon Cornell