flat assembler
Message board for the users of flat assembler.
Index
> DOS > Switching off computer |
Author |
|
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 |
|||
28 Feb 2007, 15:39 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.