Build real mode: Print Char on screen without INT loading instructions

The next site, "Writing Boot Sector Code, " is an example code that prints "A" on the screen when the system boots. From what I read, you don't need to use INT opcode to get the BIOS to do certain things? How does the code below, from the site referenced above, work without interrupts? What part of the code actually tells the machine to print “A” on the screen?

Code in question:

.code16
.section .text
.globl _start
_start:
  mov $0xb800, %ax
  mov %ax, %ds
  movb $'A', 0
  movb $0x1e, 1
idle:
  jmp idle 

ANNEX TO THE ORIGINAL QUESTION

If I use the following code, is the BIOS call written to the text buffer for me? Buffer starting at 0xb800?

   # Author: Matthew Hoggan
   # Date Created: Tuesday, Mar 6, 2012
   .code16                        # Tell assembler to work in 16 bit mode (directive)
   .section .text
   .globl _start                  # Help linker find start of program
   _start:
       movb $0x0e,     %ah        # Function to print a character to the screen                 
       movb $0x00,     %bh        # Indicate the page number
       movb $0x07,     %bl        # Text attribute
       mov  $'A',      %al        # Move data into low nibble                   
       int  $0x10                 # Video Service Request to Bios                             
   _hang:                         
       jmp  _hang                 
       .end   
+5
source share
3 answers

: "movb $'A', 0" ( "movb $0x1e, 1" , ).

: . 0xB800. , 0, , . ( , ). (char - attr - char - attr) .

, , . "movb" "A" . "A" , .

+7

- . , . 0xb800 - , . .

+1

Basically, when you call INT 10h, the BIOS will execute a procedure that does almost the same thing, by writing the characters and their attributes to the video memory. However, it’s useful to know how to write and perform these procedures yourself, so if and when you decide to switch the CPU to 32-bit protected mode, you can still print characters on the screen, because in this mode you can no longer trigger BIOS interrupts .

0
source

All Articles