Turn off computer

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Turn off computer

Post by bongomeno »

Does anybody have any assembly code that can be used to shut down the computer?

I am creating a mouse driven GUI called DREAM16 OS (which I will post about later) that needs this for its turn off computer option.

I will compile the code and load it from a DATA statement.

thanks.
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Post by bongomeno »

Also, is there a way that I can read how much memory my computer has left and how much it has total? I want to create like a meter or status bar
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Code: Select all

SUB Memory
'----------------------------------
'Get memory size (extended mem, kB)
'----------------------------------
OUT &H70, &H15
b% = INP(&H71)
OUT &H70, &H16
b1% = INP(&H71)
BaseMem = CVI(CHR$(b%) + CHR$(b1%))
OUT &H70, &H17
b% = INP(&H71)
OUT &H70, &H18
b1% = INP(&H71)
ExtMem = CVI(CHR$(b%) + CHR$(b1%))
TotalMem = BaseMem + ExtMem
PRINT "Base Memory:"; BaseMem; "K + Extended:"; ExtMem; "K  TOTAL ="; TotalMem; "K"

END SUB
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Post by bongomeno »

perfect! thanks. Now I just need to figure out how to turn off the computer... lol :lol:
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

There are several ways, but doing that could corrupt open files. Files opened need to be saved or closed first. Including Windows stuff. I have a debug routine on my 98 machine if you STAY in DOS only.

You need to determine the OS version to shutdown Windows.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Post by bongomeno »

My GUI is meant to run on a DOS machine or a 95 in DOS mode. This code will be placed at the part of the gui that saves its user made settings and shuts down. As long as it works in true DOS, it is perfect.

I will create a break key or something that shuts down the GUI for people trying it in Windows.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Then your "OS" is doomed because FEW people use DOS alone. Including myself.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Post by bongomeno »

Wel, I am creating this mainly for practice as well as for personal use. Also I am including a special exit option for Windows users that does not shut down the computer, but simply exits.

It is coming along quite well (for my 1st OS). I just got done adding new features, like the ability to drag icons on the desktop with the mouse or save the desktop as well as making it customizable.
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

MS-DOS 7.10 comes with a utility called SHUTDOWN.EXE. I don't think there's source available for it though. You might want to check Ralf Brown's interrupt list; I'm sure there's something there that could be of use to you.
OPRESION
Veteran
Posts: 61
Joined: Tue Jan 16, 2007 4:15 am
Location: Mexico

WHOOPS

Post by OPRESION »

Nodtveidt wrote:MS-DOS 7.10 comes with a utility called SHUTDOWN.EXE.
WHOOPS, I USE THE MS-DOS 7.1 = WINDOWS 98SE BUT I COULDN'T FIND IT;
INSTEAD I FOUND IT IN A MORE ADVANCED WINDOWS VERSIONS:
Microsoft DOS shutdown command

IN MY WIN98SE I USE:

SHELL "START/MAX C:\WINDOWS\RUNDLL32.EXE USER.EXE,EXITWINDOWS"
MY PAGE: http://Qbasic.phatcode.net" target="_blank
(I ONLY USE WINDOWS 98SE YET, BELIEVE IT OR NOT)
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

IS YOUR CAP LOCK KEY STUCK? QUIT YELLING AT PEOPLE GENIUS!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Post by bongomeno »

i lolled. :D
Thanks for the post anyways! I will use this if it works with true dos, otherwise I will have to write my own routine.
OPRESION
Veteran
Posts: 61
Joined: Tue Jan 16, 2007 4:15 am
Location: Mexico

Post by OPRESION »

burger2227 wrote:IS YOUR CAP LOCK KEY STUCK?
NO, BUT I LIKE UPPERCASING FOR EVERYTHING.
burger2227 wrote:QUIT YELLING AT PEOPLE GENIUS!
I DO NOT LISTEN ANY NOISE IN MY SORROUNDINGS.
SEE THIS PAGE OF MY WEBSITE?
http://basic.phatcode.net/tut/bco.htm
IN THE FUTURE MY WHOLE SITE WILL BE SEEN THAT WAY,
BUT I HAVE NOT HAD TIME TO DO IT (SORRY!)
MY PAGE: http://Qbasic.phatcode.net" target="_blank
(I ONLY USE WINDOWS 98SE YET, BELIEVE IT OR NOT)
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Post by bongomeno »

ummm.... Im sorry, but your site is HARD TO READ! I have seen it before and gave up on it really fast.

My advice would be to change the colors to something more eye friendly.

The background and text should always be light on dark or dark on light.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

The fellow is pretty good, but he does not seem to grasp that people cannot read his site pages.

Then he comes here and YELLS at everybody where we can see it VERY well?

LOL :shock:
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
OPRESION
Veteran
Posts: 61
Joined: Tue Jan 16, 2007 4:15 am
Location: Mexico

Post by OPRESION »

bongomeno wrote:My advice would be to change the colors to something more eye friendly.
I AGREE WITH THAT, BUT I'M THOSE KIND OF NERDS WHO CAN LISTEN EVILS
AND THEY MENACE ME IF I USE ANOTHER COLORS. SOME DAY I'LL CHANGE
THEM FOR THE 'MATRIX' COLORS THAT I LIKE THEM SINCE THE MS-DOS WAS
THE KING OF THE HILL WITH THE GREEN PHOSPHORUS MONITORS.
MY PAGE: http://Qbasic.phatcode.net" target="_blank
(I ONLY USE WINDOWS 98SE YET, BELIEVE IT OR NOT)
User avatar
BigBadKing
Veteran
Posts: 83
Joined: Fri Oct 09, 2009 12:39 pm
Location: Space
Contact:

Post by BigBadKing »

if you are going to make a matrix-colored site, with everything uppercase.
nobody will bother to visit your site... put up a Unique-Visitor hit counter
on your site, check your hit counter afew days after and see how many
persons visited your site.
<a href="http://mccorp.orgfree.com">Macselent Corporation Offical Site</a>
User avatar
BigBadKing
Veteran
Posts: 83
Joined: Fri Oct 09, 2009 12:39 pm
Location: Space
Contact:

Post by BigBadKing »

code to shutdown windows:

[code]
SHELL "START C:\Windows\RUNDLL.EXE user.exe,exitwindows exec"
SHELL "exit"
[/code]

remove the space between 'exitwindows' and 'exec' then run the code.
<a href="http://mccorp.orgfree.com">Macselent Corporation Offical Site</a>
OPRESION
Veteran
Posts: 61
Joined: Tue Jan 16, 2007 4:15 am
Location: Mexico

Post by OPRESION »

BigBadKing wrote:if you are going to make a matrix-colored site, with everything uppercase. nobody will bother to visit your site.
I THINK IT WOULD BE EASIER TO BE READ. I HAVE COUNTED THE VISITORS SINCE I DID
CREATE THE PAGE AND I HAVE AN AVERAGE OF 300 NOT UNIQUE VISITORS BY DAY.
BigBadKing wrote:... put up a Unique-Visitor hit counter on your site,...
I DID TRY IT USING AN INNER COUNTER OF THE SERVER BUT IT GIVES ME AN
ERROR THAT I COULDN'T SOLVE (IT NEEDS A FILE THAT IT IS NOT CREATED).
MY PAGE: http://Qbasic.phatcode.net" target="_blank
(I ONLY USE WINDOWS 98SE YET, BELIEVE IT OR NOT)
User avatar
BigBadKing
Veteran
Posts: 83
Joined: Fri Oct 09, 2009 12:39 pm
Location: Space
Contact:

Post by BigBadKing »

*sign* a NON-UNIQUE hit counter, counts every page visit. i tried to
use it on my site but replaced it with an UNIQUE one. when i had a NON
UNIQUE counter, everything i visited one my own pages. it was added
by one. so a non-unique counter counts every-yours and your-visitor's
visit to every page...
<a href="http://mccorp.orgfree.com">Macselent Corporation Offical Site</a>
Post Reply