How do I shut down the computer?
The following code restarts the machine:
void far(*ptr)();
ptr=0xFFFF0000; //location of ROM shutdown routine
(*ptr)();
Shuting Down the computer (real mode)
RE:Shuting Down the computer (real mode)
push the power button! lol
Look up the specs to ACPI and/or APM for how modern OSs turn the computer off through software (only works on motherboards which support ACPI or APM, of course).
Jeff
Look up the specs to ACPI and/or APM for how modern OSs turn the computer off through software (only works on motherboards which support ACPI or APM, of course).
Jeff
RE:Shuting Down the computer (real mode)
all i did was make a inttrupt to halt the pc
_intinit: ; _intinit label
cli ; disable interrupts
xor ax, ax ; Set es to the real-mode interrupt table at 0x00000
mov es, ax
mov ax, _int40h
mov [es:0x40*4], ax ; set the address for interrupt 40h
mov ax, cs
mov [es:0x40*4+2], ax ; set the segment for interrupt 40h
sti ; reenable intrrupts
jmp _kstart ; jmp to _kstart (the main kernel)
_int40h: ; _int40h label
; other halt functions go here
jmp .halt ; jmp to halt in _int40h
.halt ; halt lable in _int40h
jmp .halt ; jmp to halt in _int40h
iret ; return from interrupt (never reached)
at the start of my kernel i do
jmp _intinit
and when i want to shut the pc down i call
int 0x40
hope that helps
it will work on all pc as far as i know (i have never had problems)
_intinit: ; _intinit label
cli ; disable interrupts
xor ax, ax ; Set es to the real-mode interrupt table at 0x00000
mov es, ax
mov ax, _int40h
mov [es:0x40*4], ax ; set the address for interrupt 40h
mov ax, cs
mov [es:0x40*4+2], ax ; set the segment for interrupt 40h
sti ; reenable intrrupts
jmp _kstart ; jmp to _kstart (the main kernel)
_int40h: ; _int40h label
; other halt functions go here
jmp .halt ; jmp to halt in _int40h
.halt ; halt lable in _int40h
jmp .halt ; jmp to halt in _int40h
iret ; return from interrupt (never reached)
at the start of my kernel i do
jmp _intinit
and when i want to shut the pc down i call
int 0x40
hope that helps
it will work on all pc as far as i know (i have never had problems)