zoukankan      html  css  js  c++  java
  • 5.汇编语言--输入输出

    测试1

    .586    
    .MODEL flat,stdcall
    option casemap:none
    
    ; inc 是一个头文件
    include    windows.inc
    include user32.inc
    include     kernel32.inc
    ;msvcrt.inc 引用c中的输入输出功能
    include    msvcrt.inc
    
    ;库文件
    includelib user32.lib
    includelib kernel32.lib
    includelib    msvcrt.lib
    
    .data
    tex db "你是个小可爱",0
    text db "这是一个标题",0
    .code
    main proc
    ;push 入栈 按钮  0应该是据点的意思
        push 0
    ;offset 相当于指针,伪指令
        push offset text
    ;下面是标题
        push offset tex
        push 0
        call MessageBox
    
    ;堆栈平衡一下,不懂 传了4个参数,一个32位 就是16个字节, 测试了不要这一段也可以
        add esp,16
        push 0
        call ExitProcess
        add esp,4
    
    main ENDP
    END    main

    2.利用msvcrt.inc 里面的字符输出

    .586    
    .MODEL flat,stdcall
    option casemap:none
    
    ; inc 是一个头文件
    include    windows.inc
    include user32.inc
    include     kernel32.inc
    ;msvcrt.inc 引用c中的输入输出功能
    include    msvcrt.inc
    
    ;库文件
    includelib user32.lib
    includelib kernel32.lib
    includelib    msvcrt.lib
    
    .data
    tex db "你是个小可爱",0
    ;text db "这是一个标题",0
    .code
    main proc
        ; c 语言中打印 printf("%s"变量) crt_printf crt里面的一个功能
        push offset tex
        call crt_printf
        push 0
        call ExitProcess
        add esp,4
    
    main ENDP
    END    main

     3.字符的输入和输出表示

    .586    
    .MODEL flat,stdcall
    option casemap:none
    
    ; inc 是一个头文件
    include  windows.inc
    include user32.inc
    include kernel32.inc
    ;msvcrt.inc 引用c中的输入输出功能
    include  msvcrt.inc
    
    ;库文件
    includelib user32.lib
    includelib kernel32.lib
    includelib msvcrt.lib
    
    .data
    text2 db 0
    ; 用来接收
    format db "%s",0
    
    .code
    main proc
        push offset text2
        push offset format
        call crt_scanf
        ;因为crt_scanf 需要两个参数,所以前面push 两个
    
        add esp,8
        ; c 语言中打印 printf("%s"变量) crt_printf crt里面的一个功能
        push offset text2
        call crt_printf
        push 0
        call ExitProcess
        add esp,4
    
    main ENDP
    END    main

  • 相关阅读:
    keepalived
    设置Suse linux 用户远程登录超时时间
    启用Linux云平台oracle数据库实口令复杂性函数:PASSWORD_VERIFY_FUNCTION=NULL
    将tomcat7解压版注册为windows系统服务
    linux 在后台运行数据库导入导出命令
    suse enterprise Linux 11上配置 oracle11g和tomcat开机自启动
    Linux下的Tomcat JVM 调优
    oracle 11g 常用命令
    如何运行jnlp文件
    查询oracle 数据库 SQL语句执行情况
  • 原文地址:https://www.cnblogs.com/trevain/p/14502122.html
Copyright © 2011-2022 走看看