OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 5:13 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: What does 'mov ah, 0x0e' mean and do?
PostPosted: Fri Nov 25, 2016 2:44 pm 
Offline

Joined: Fri Nov 25, 2016 2:42 pm
Posts: 2
I am learning to make a very basic operating system. (I'm only 13) But I don't understand something. What does mov ah, 0x0e mean and why is it needed to print characters on the screen?


Last edited by jordanbaron12 on Fri Nov 25, 2016 3:25 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: What does 'int 0x10' mean and do?
PostPosted: Fri Nov 25, 2016 3:12 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
jordanbaron12 wrote:
What does int 0x10 mean

The INT instruction calls an interrupt handler.

jordanbaron12 wrote:
and why is it needed to print characters on the screen?

You don't need INT 0x10 to display characters on the screen.


Top
 Profile  
 
 Post subject: Re: What does 'mov ah, 0x0e' mean and do?
PostPosted: Fri Nov 25, 2016 3:26 pm 
Offline

Joined: Fri Nov 25, 2016 2:42 pm
Posts: 2
Oh shoot. Wrong line of code. I'm sorry, I edited my post so you can delete your reply.


Top
 Profile  
 
 Post subject: Re: What does 'mov ah, 0x0e' mean and do?
PostPosted: Fri Nov 25, 2016 4:20 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
It's still basically the same answer, because INT 0x10 is the interrupt vector for the majority of the standard BIOS routines; the value 0x0E (which is 14 decimal) is the number of the specific Basic Input/Output Service (BIOS) operation known as "Teletype Output", which puts a single character in into the current text video buffer and advances a hidden pair of x,y values by one.

In other words, it prints one character of text the the console in text mode, and moves the cursor to the next position.

However, as Octocontrabass said, it isn't actually necessary; it just happens to be convenient when writing a boot loader, because, well, it's already there to be used. It isn't the only way to write text to the console, nor the best way, or even a particularly good way, but it is the easiest way when you are trying to cram as much as you can into a 512 byte boot sector, so if your boot loader is sending something to the text console, that's usually the way you would do it.

Mind you, most first stage boot loaders only use any text output when you are debugging them (yo would take it out later to save space, usually), and even that's assuming you are writing your own boot loader rather than using an existing one such as GRUB or BootMagic - which is what we usually recommend, as writing the boot loader is a lot of work for very little real payoff when designing a new OS.

I am among those who say that it is a useful exercise when starting out, but only as an exercise, and only to the point where you can load another sector and jump to it. Beyond that, unless you are planning to do something really, really unusual, rolling your own boot loader is sort of a waste of time.

Getting back to the issue at hand, you would usually only use the BIOS for the very start of an operating system, especially if you are planning to run it in 32-bit or 64-bit mode - the BIOS routines only work in 16-bit mode, and while there are ways to step down to 16-bit mode from 32-bit mode, doing that is both terribly inefficient and is more work than writing a proper 32-bit driver would have been in the first place.

TL;DR: INT 0x10 has several parts, and putting 0x0E in AH tells it which one to use. But you only need to know that for the very start of things anyway, and probably not even then.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: What does 'mov ah, 0x0e' mean and do?
PostPosted: Mon Nov 28, 2016 8:33 am 
Offline
Member
Member
User avatar

Joined: Mon Dec 28, 2015 11:11 am
Posts: 401
Quote:
(I'm only 13)

Am I the only one who notices that this guy insults himself?


Top
 Profile  
 
 Post subject: Re: What does 'mov ah, 0x0e' mean and do?
PostPosted: Mon Nov 28, 2016 9:17 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 10, 2016 7:35 am
Posts: 167
Location: Lancaster, England, Disunited Kingdom
To describe someone as 13 cannot be seen as an insult. I mean, I was 13 once!
He is simply looking forward to the even greater distinction of being 14.

(Starts going downhill after that...)


Top
 Profile  
 
 Post subject: Re: What does 'mov ah, 0x0e' mean and do?
PostPosted: Wed Dec 07, 2016 4:28 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 273
jordanbaron12 wrote:
I am learning to make a very basic operating system. (I'm only 13) But I don't understand something. What does mov ah, 0x0e mean and why is it needed to print characters on the screen?



Interrupt 10h needs a value in AH/AL/AX to know what to do. To print characters on the screen, int 10h needs AH set to 0x0e.
"mov ah, 0x0e" is simply telling NASM to "Hey, please move the byte 0x0e to the register "ah"."

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 83 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group