Display strings in the video memory (call subroutine implementation)

Source: Internet
Author: User
Tags mul

[Html] assume cs: codesg, ds: datasg segment db 'I love China! ', 0 datasg ends codesg segment start: mov ax, datasg mov ds, ax mov dl, 12; row number mov dh, 20 to be displayed; call show mov ax, 4c00h int 21 h, the column number to be displayed. In the display string, convert the decimal number to the corresponding ascii code for display. Show: mov ax, 0b800h mov es, ax; mov di, dl * 160 + dh * 2; transmit the destination to di; mov al, 160 mov ax, 160 mul dl mov di, ax mov ax, 2 mul dh add di, ax mov si, 0 mov ch, 0 s1: mov al, ds: [si] mov cl, al jcxz over mov ah, 2 mov es: [di], ax inc si add di, 2 jmp s1 over: ret codesg ends end start note: 1. in show, the jmp label is used to simulate the loop, because the length of the string to be displayed is unknown in advance. Therefore, print is ended Based on 0 at the end.

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.