zoukankan      html  css  js  c++  java
  • [汇编语言]-第九章 在屏幕中间分别显示绿底红色,白底蓝色字符串"welcome to masm!"

     1 ;在屏幕中间分别显示绿色,绿底红色,白底蓝色字符串"welcome to masm!"
     2 assume cs:codesg,ds:datasg,ss:stacksg
     3 datasg segment
     4     db 'welcome to masm!'
     5     db 02h,24h,71h
     6 datasg ends
     7 stacksg segment
     8     db 8 dup(0)
     9 stacksg ends
    10 codesg segment
    11 start:    mov ax,datasg
    12         mov ds,ax
    13         
    14         mov ax,stacksg
    15         mov ss,ax
    16         mov sp,10H
    17         
    18         mov bx,0
    19         mov di,0
    20         
    21         mov ax,0B872H  ;;0B828H屏幕第一个位置
    22         mov cx,3
    23     s3: push cx
    24         push ax
    25         push di
    26         
    27         mov es,ax
    28         mov si,0
    29         mov di,0
    30         mov cx,10h
    31     s1: mov al,ds:[bx+si]
    32         mov es:[bx+di],al
    33         inc si
    34         add di,2
    35         loop s1
    36         
    37         mov si,1
    38         pop di
    39         mov al,ds:10h[bx+di]
    40         
    41         mov cx,10h 
    42     s2: mov es:[bx+si],al
    43         add si,2
    44         loop s2
    45         inc di
    46         pop ax
    47         add ax,0ah
    48         pop cx
    49         loop s3
    50         mov ax,4c00h
    51         int 21h
    52 codesg ends
    53 end start

     

    在b872处显示'welcome to masm!'

     1 assume cs:code,ds:data
     2 data segment
     3     db 'welcome to masm!'
     4     db 02h,24h,71h
     5 data ends
     6 code segment
     7 start:
     8         mov ax,0b872H
     9         mov es,ax
    10         
    11         mov ax,data
    12         mov ds,ax
    13         
    14         mov bx,0
    15         mov cx,16
    16         mov di,0
    17     s:  
    18         mov al,ds:[bx]
    19         mov ah,ds:[18]
    20         mov es:[di],ax
    21         inc bx
    22         add di,2
    23         loop s
    24 
    25         mov ax,4c00h
    26         int 21h
    27 code ends
    28 end start

    一个字符两个字节的存储方式,低字节存储ASCII,高字节存储字符属性,一行共80个字符,占160个字节.

    属性字节格式:

    7  6  5  4  3  2  1  0

    BL R  G  B  I  R  G  B

    7闪烁

    6 5 4 背景

    3 高亮

    2 1 0 前景

    R red

    G green

    B blue

    红底绿字:01000010B

    红底闪烁绿字: 11000010B

    红底高亮绿字: 01001010B

    黑底白字: 00000111B

    白底蓝字: 01110001B

    闪烁的效果必须在全屏DOC方式下才能看到.(ps:测试一直没看到闪烁)

  • 相关阅读:
    java作业利用递归解决问题
    java课堂测试2(两种方式)
    java模拟验证码生成
    java选做猜数字
    java课堂动手测试
    java课堂作业,求多参数的和
    《大道至简》第一章伪代码形式读后感
    《大道至简》读后感
    关于《大道至简》第八章的收获
    [JLOI2012]树 倍增优化
  • 原文地址:https://www.cnblogs.com/galoishelley/p/3581899.html
Copyright © 2011-2022 走看看