INT 10h Using

INT 10h / AH = 13h - write string.
input:
AL = write mode:
    bit 0: update cursor after writing;
    bit 1: string contains attributes.
BH = page number.
BL = attribute if string contains only characters (bit 1 of AL is zero).
CX = number of characters in string (attributes are not counted).
DL,DH = column, row at which to start writing.
ES:BP points to string to be printed.
-----------------------------------------------------
Bit color table:
Character attribute is 8 bit value, low 4 bits set foreground color, high 4 bits set background color. Background blinking not supported.
HEX    BIN        COLOR
0      0000      black
1      0001      blue
2      0010      green
3      0011      cyan
4      0100      red
5      0101      magenta
6      0110      brown
7      0111      light gray
8      1000      dark gray
9      1001      light blue
A      1010      light green
B      1011      light cyan
C      1100      light red
D      1101      light magenta
E      1110      yellow
F      1111      white

Example of INT 10h
    ;; INT10h.asm
    ;; Test the using of INT 10h
    ;; BpLoveGcy
    ;; 2006-11-24
    ;; compile
    ;; nasm INT10h.asm -o INT10h.com
    ;; run the INT10h.com in DOS
    segment .data
    Message    db    "Hello, INT 10h! Great, I can use it!"
        
    segment .text
    org    0100h
    mov    ax,    cs
    mov    ds,    ax
    mov    es,    ax    
    call    PrintMessage
    
PrintMessage:
    ;points to string ES:BP points to string to be printed
    mov    ax,    Message 
    mov    bp,    ax    

    ;number of characters in string
    mov    cx,    40
    
    ;; Init registers for INT 10h 
    ;; Set AH=13h
    mov    ah,    13h
    ;; Set AL=01h
    mov    al,    01h
    ;; Set character attributes
    ;; 09h    light blue
    mov    bl,    09h
    ;; Init print start location
    ;; page number=0
    mov    bh,    00h
    ;; column=2,row=5
    mov    dl,    02h
    mov    dh,    05h
    
    int     10h
    ret
posted @ 2006-11-21 23:58  Freedom  阅读(1019)  评论(1编辑  收藏  举报