flat assembler
Message board for the users of flat assembler.

Index > DOS > Switching off computer

Author
Thread Post new topic Reply to topic
andreism



Joined: 10 Feb 2007
Posts: 9
Location: Russia, Moscow
andreism 28 Feb 2007, 13:50
Hello all! Does anyone know which interrupt is responible for switching off computer? There's a howto about reboot in DOS but nothing about switching it off.
Post 28 Feb 2007, 13:50
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 28 Feb 2007, 15:39
Here is some code posted by smiddy on the DexOS forum for that, it is coded to run in real mode, and does not use any DexOS functions so should work fine in dos.
Code:
   mov ax,5300h                     ; See if APM available   mov bx,0                         ; device = BIOS   int 15h   mov   dx,NoPowerManagment   jc .Error   cmp ax,101h                      ; See if version 1.1 or greater   mov dx,WrongVersion   jc .Error   mov [PowerManagmentVersion],ax   mov ax,5301h                     ; Do a real mode connection   mov bx,0                         ; device = BIOS   int 15h   jnc .NoConnectionError   cmp ah,2                         ; Pass if already connected   mov   dx,ErrorMessage              ; else error   jnz .Error.NoConnectionError:   mov ax,530eh                     ; Enable latest version of APM   mov bx,0                         ; device = BIOS   mov cx,[PowerManagmentVersion]   ; version   int 15h   mov   dx,ErrorMessage   jc .Error   mov ax,530dh                     ; Now engage and enable CPU management   mov bx,1                         ; device = all   mov cx,1                         ; enable   int 15h   mov   dx,ErrorMessage   jc .Error   mov ax,530fh   mov bx,1                         ; device = ALL   mov cx,1                         ; enable   int 15h   mov   dx,ErrorMessage   jc .Error   mov ax,5307h                     ; Do the power down   mov bx,1                         ; device = ALL   mov cx,3                         ; mode = OFF   int 15h                          ; shutdown CPU   mov   dx,ErrorMessage.Error:    mov   ah,9    int   21h   jmp  $             ; Error just loopPowerManagmentVersion dw 0NoPowerManagment      db 'No power management functionality',24hErrorMessage          db 'Power management error',24hWrongVersion          db 'Need APM version 1.1 or better',24h    
Post 28 Feb 2007, 15:39
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.