-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel.asm
More file actions
31 lines (26 loc) · 826 Bytes
/
kernel.asm
File metadata and controls
31 lines (26 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
org 0x7c00 ;Store program/data at this point in memory (16 bit - 48 kB, 32 bit - 4 GB ...)
jmp entry
;ax is a 16-bit register
entry:
mov ax, 0
mov ss, ax ;reset ss register
mov ds, ax ;reset ds register
mov es, ax ;reset es register
mov si, msg
putloop:
mov al, [si] ;copy a byte pointed by si into the lower 8-bits of AX
add si, 1 ;increment si pointer
cmp al, 0 ;check if reach end of string
jz fin ;if reached end, go to finish
mov ah, 0x0e ;set upper 8-bits of AX for printing
mov bx, 15 ;set bx for printing
int 0x10 ;interrupter to signal printing a char
jmp putloop
fin:
HLT ;halt till key press
jmp fin
msg: ;message array
db 0x0a, 0x0a ;two line feeds
db "hello, world"
db 0x0a ;one line feed
db 0 ;string end char /0