Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
84c08b23
authored
Sep 05, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Change function to take number of bytes as argument
parent
ceba1955
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
boot.asm
boot.asm
View file @
84c08b23
...
...
@@ -65,33 +65,24 @@ PrintChar: ; print char at AL
mov
bl
,
0x07
; light gray
int
0x10
; print character
ret
MOV
AH
,
0x0E
; Teletype Mode
MOV
BH
,
0x00
; Page zero
MOV
BL
,
0x07
; Light Gray
INT
0x10
; Print Character
RET
;------------------ DATA BLOCK ------------------;
str1
db
'
Hello
World
'
,
0
; Hello World
str2
db
'
WHY
IS
THIS
'
,
0
hexChars
db
'
0123456789
abcdef
'
; Used for hex formatting
PrintHexStr
:
PrintHexStr
:
; print <ax> bytes starting at [si]
mov
di
,
si
; initilize the loop registers
mov
dx
,
si
add
dx
,
ax
nexthchar
:
mov
al
,
[si]
; grab next char
or
al
,
al
; if char is null term
jz
exith
; then return
cmp
di
,
dx
jge
exith
; NO IDEA HOW THIS WORKS
mov
al
,
BYTE
[di]
; grab next char
call
PrintHexChar
; else print char
inc
si
; inc pointer to next char
inc
di
jmp
nexthchar
; loop
exith
:
ret
PrintHexChar
:
;; call PrintChar
xor
ebx
,
ebx
mov
cl
,
al
mov
bl
,
al
and
bl
,
0xf0
...
...
@@ -104,11 +95,17 @@ PrintHexChar:
call
PrintChar
ret
;------------------ DATA BLOCK ------------------;
str1
db
'
Hello
World
'
,
0
; Hello World
str2
db
'
WHY
IS
THIS
'
,
0
hexChars
db
'
0123456789
abcdef
'
; Used for hex formatting
Main
:
;main section
nop
nop
mov
si
,
str2
call
PrintStr
mov
si
,
str2
mov
si
,
str1
mov
ax
,
10
call
PrintHexStr
; print string
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment