Use BIOS interrupt display string Note (int 10h 13th interrupt)

Source: Internet
Author: User

The 10H interrupt of the BIOS, interrupt 13th, is used to display the string with the parameters:

1, Ah=13h

2. al= display mode

If al=0, indicates that the target string contains only characters, the property is included in the BL and does not move the cursor

If al=1, indicates that the target string contains only characters, attributes are included in the BL, and the cursor is moved

If al=2, indicates that the target string contains characters and attributes and does not move the cursor

If al=3, indicates that the target string contains characters and attributes, move the cursor

In short, it can be summed up as:

|bit7|bit6|bit5|bit4|bit3|bit2|bit1|bit0| AL

A BIT0 of 0 means that the cursor is not moved and 1 means that the cursor is moved

A BIT1 of 0 means that the string contains only characters, and 1 indicates that the string contains the property

Bit2~bit7 not used


3. BH Indicates the number of video area pages

4. If Al's BIT1 is 0, then BL represents the display attribute. Properties are:

|bit7|bit6|bit5|bit4|bit3|bit2|bit1|bit0| BL

BIT7: Whether the background flashes. 0 does not blink, 1 flashes

BIT6~BIT4 for background color, rgb,000 for black, 111 for white

BIT3 is 1, the foreground color is highlighted, and 0 is not highlighted

Bit2-bit0 for foreground, meaning with background color

5. CX is string length

6, DH indicated in the first few lines display (0 is the line)

7, DL indicated in the number of columns display (0 is the first column)

8. ES:BP pointer to string


Here is a test code that shows a blinking white background with a red foreground.

This is a section of the sector Boot program, written in the NASM syntax, tested in a Windows environment. You can see the results of the operation using virtual machines such as Bochs or VirtualBox.

Test.asm:

mov ax, 0x7c0                         ; The BIOS loads the code into memory 0x7c00, so the segment address is 0x7cmov DS, ax                            ; initialize data segment mov es, ax                            ; used to point to string mov ax, Message                       ; es:bp point to the string to display mov BP, Axmov Ah, 0x13                          ; Ah for 0x13, call 13th interrupt mov al, 0                             ; Al for 0, do not move cursor, no attribute content in string mov bh, 0                             ; No. 0 page display mov bl, 0xFC                          ; flashing white background, red Highlight foreground mov cx, messagelen                    ; string length mov dx, 0                             ; dh=0, dl=0, No. 0 row, No. 0 column int 10h                               ; call 10H interrupt jmp $                                 ; infinite loop to prevent code from entering data area mes Sage DB "This is a test!" Messagelen equ $-messagetimes 510-($-$$) DB 0                 ; Fill 0 db 0x55 in the Middle    , 0xaa                     ; write bootstrapper flags at No. 511 and 512 bytes


Compilation method: Nasm Test.asm-o Test.bin


The Bochs configuration file is:

megs:32romimage:file= $BXSHARE/bios-bochs-latestvgaromimage:file= $BXSHARE/vgabios-lgpl-latestvga:extension= Vbefloppya:1_44=test.bin, Status=insertedboot:alog:bochsout.txtmouse:enabled=0cpu:count=1,ips=15000000vga_ Update_interval:150000i440fxsupport:enabled=1

The effect is (static cannot see the flicker effect):


Use BIOS interrupt display string Note (int 10h 13th interrupt)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.