美文网首页工作生活
《汇编语言》实验9

《汇编语言》实验9

作者: infinite_stack | 来源:发表于2019-06-29 17:20 被阅读0次

    P187~189
    编程:在屏幕中间分别显示绿色、绿底红色、白底蓝色的字符串"welcome to masm!"。

    assume cs:code
    
    data segment
      db 'welcome to masm!'
      db 01110001b ; front: blue  , background: white
      db 00100100b ; front: red   , background: green
      db 00000010b ; front: green , background: black
    data ends
    
    stack segment
      dw 8 dup (0)
    stack ends
    
    code segment
    start: mov ax,data
           mov ds,ax
           mov ax,stack
           mov ss,ax
           mov sp,16
           mov ax,0b800h
           mov es,ax
    
           mov si,06e0h       ; the 11th row
    
           mov cx,3
       s0: mov bx,cx
           mov ah,[bx+15]     ; read the color of the row
           mov bx,40h         ; the 32th col
           push cx
           mov di,0
           mov cx,16
        s: mov al,[di]        ; read character
           mov es:[bx+si],ax  ; write formatted character
           inc di             ; next character
           add bx,2           ; next col
           loop s
           add si,0a0h        ; next row
           pop cx
           loop s0
    
           mov ax,4c00h
           int 21h
    
    code ends
    end start
    

    相关文章

      网友评论

        本文标题:《汇编语言》实验9

        本文链接:https://www.haomeiwen.com/subject/yvwpcctx.html