• [汇编语言]-第九章 在屏幕中间分别显示绿底红色,白底蓝色字符串"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:测试一直没看到闪烁)

  • 相关阅读:
    在android 5.0以上,如何判断当前应用是在前台还是后台
    Android实现手机摄像头的自动对焦
    抓包获取百度音乐API
    andriod 自定义来电界面功能
    Android 自定义相机
    解决Android拍照保存在系统相册不显示的问题
    有关Color和Drawable你所不知道的那些内容
    Android主题切换方案总结
    设置background属性使用selector的时候内置?attr报错的解决方案
    一步一步解析google camera2 demo(三)
  • 原文地址:https://www.cnblogs.com/galoishelley/p/3581899.html
Copyright © 2020-2023  润新知