Skip to content

Commit 962b6e3

Browse files
committed
Added shutdown function
1 parent ecf162c commit 962b6e3

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

boot.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ section .text:
4949
_stop:
5050
push msg2
5151
call _printformat
52-
jmp $ ; Stops the processor
52+
call _shutdown
5353

5454

5555
; Data Section
5656
%include "functions/io.asm"
5757
%include "functions/disk_mng.asm"
58+
%include "functions/shutdown.asm"
5859

5960
msg1: db "Hello, There!\nDo You want to enter 32 bit mode?[Y]/[N](default=Y) \0" ; Printable string
6061
msg2: db "Goodby!\0"

functions/shutdown.asm

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
global _shutdown
2+
3+
section .text:
4+
_shutdown:
5+
mov al, 0x01 ; Connect to real mode interface
6+
mov ah, 0x53 ; Use APM control
7+
xor bx, bx ; BX is BIOS id so it set to 0
8+
int 15h ; Use BIOS interruption for additional functions
9+
10+
mov al, 0x0e ; Set APM version function
11+
mov ah, 0x53 ; Use APM control
12+
xor bx, bx ; BX is BIOS id so it set to 0
13+
mov ch, 0x01 ; Set major APM version to 1
14+
mov cl, 0x02 ; Set minor APM version to 2
15+
int 15h ; Use BIOS interruption for additional functions
16+
17+
mov al, 0x07 ; Set device state function
18+
mov ah, 0x53 ; Use APM control
19+
mov bx, 0x0001 ; Select all devices
20+
mov cx, 0x03 ; Set shutdown mode
21+
int 15h ; Use BIOS interruption for additional functions

0 commit comments

Comments
 (0)