Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 0x7c00 ; Loaded at address 0x7c00 by BIOS.
- CR equ 0x0d
- LF equ 0x0a
- ; http://en.wikipedia.org/wiki/BIOS_color_attributes
- black equ 0x00
- blue equ 0x01
- green equ 0x02
- cyan equ 0x03
- red equ 0x04
- magenta equ 0x05
- brown equ 0x06
- light_grey equ 0x07
- dark_grey equ 0x08
- light_blue equ 0x09
- light_green equ 0x0a
- light_cyan equ 0x0b
- light_red equ 0x0c
- light_magenta equ 0x0d
- yellow equ 0x0e
- white equ 0x0f
- start:
- jmp main
- print:
- lodsb
- or al, al
- jz print_end
- mov ah, 0x0e
- mov bl, white
- int 0x10
- jmp print
- print_end:
- ret
- switch_to_mode_0x12: ; VGA 640x480 16
- ; http://en.wikipedia.org/wiki/INT_10H
- ; Set video mode
- ; AH=00h
- ; AL = video mode
- xor ah, ah
- mov al, 0x12
- int 0x10
- ret
- main:
- xor ax, ax ; Set DS register to zero
- mov ds, ax ; because we set org to 0x7c00
- cld
- ; http://en.wikipedia.org/wiki/INT_10H
- ; Teletype output
- ; AH=0Eh
- ; AL = Character
- ; BH = Page Number
- ; BL = Color (only in graphic mode)
- ;
- ; Need to switch to a graphic mode.
- ; http://www.wagemakers.be/english/doc/vga lists mode 0x12 as a graphic mode.
- call switch_to_mode_0x12
- ; http://en.wikipedia.org/wiki/INT_10H
- ; Set background/border color
- ; AH=0Bh,
- ; BH = 00h
- ; BL = Background/Border color (border only in text modes)
- mov ah, 0x0b
- xor bh, bh
- mov bl, white
- int 0x10
- mov si, msg
- call print
- cli
- hlt
- msg db 'Hello', CR, LF, '-----', 0
- times 512-($-$$) db 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement