Windows assembly with color display Hello World

Source: Internet
Author: User
; Associate the codesm segment with the CS register, and associate the data segment with the DS register assume Cs: codesg, DS: data; the start data segment defined by the data segment; define a word type variable hello. Note that it must end with '$', which is determined by the DOS system call. When using the feature, pay attention to the following issues.; ① The string to be displayed must first be placed in the memory data zone (DS segment), and use the '$' symbol as the end sign. ② The base address and offset address of the first string address should be stored in the DS and DX registers respectively.; Hello DW 'Hello world assmble ',' $ '; end data ends defined by the data segment; start code segment defined by the Code segment; start of the entire program :; store the first address of data in mov ax and data in ax; Set ds to the content in ax, that is, the first address of data in mov ds, ax; set to the scroll window mov ax, 0600 h; set the green background, red background, and red background to the green text; the meaning of the eight bits in BH:; Mode: BL r g B I r g B; (flashing) (background) (highlighted) (foreground) mov BH, 1110810b; row and column values mov CX and 050ah in the upper left corner of the window; row and column values mov Dx and 0a30h in the lower right corner of the window; call bios, display Mode: 640x350 4-color int 10 h; set the cursor position mov ah, 2; column coordinate mov dx, 0714 h; page number mov BH, 0; call bios, display Mode: 640x350 4-color int 10 h; the offset address of the variable to be displayed is put into DX mov dx, offset hello; call the DOS 9 function, display the string function mov ah, 9 h int 21 h; call the function call of the DOS 4ch, that is, the program returns the function mov ah, 4ch int 21 h; the end code ends defined by the Code segment; end start of the entire program
Related Article

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.