zoukankan      html  css  js  c++  java
  • 8086汇编学习小记王爽汇编语言课程设计1

      1 ;call 的时候ip入栈
      2 assume cs : codesg, ds : datasg, ss : stacksg
      3 
      4 datasg SEGMENT
      5      db '19751976197719781979','1980','1981','1982','1983','1984','1985','1986','1987','1988','1989','1990','1991','1992','1993','1994','1995'
      6      dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514,345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
      7      dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226,11542,14430,15257,17800
      8 datasg ENDS
      9 
     10 stacksg SEGMENT
     11     dw 16 dup (0)
     12 stacksg ENDS
     13 
     14 codesg SEGMENT
     15 
     16 changeToStr:    push si
     17         push cx
     18         mov bp, sp
     19     s0:    mov cx, 10
     20         call divdw
     21         add cl, '0'
     22         mov ch, 02h
     23         push cx
     24         cmp ax, 0
     25         jnz s0
     26 
     27     s1:    pop ax
     28         mov es : [si], ax
     29         add si, 2
     30         cmp sp, bp
     31         jnz s1
     32         pop cx
     33         pop si
     34         ret
     35 
     36 divdw:    push bp
     37     push ax
     38     mov ax, dx
     39     mov dx,0
     40     div cx
     41     mov bp, ax
     42     pop ax
     43     div cx
     44     mov cx, dx
     45     mov dx, bp
     46     pop bp
     47     ret
     48 
     49 start:    mov ax, datasg
     50     mov ds, ax
     51     mov ax, 0b800h
     52     mov es, ax
     53     mov ax, stacksg
     54     mov ss, ax
     55     mov sp, 32
     56 
     57     mov cx, 21
     58     mov si, 0
     59     mov bx, 0
     60     mov di, 0
     61 s:    mov al, [bx]
     62     mov es : [si], al
     63     mov byte ptr es : [si + 1], 02h
     64     mov al, [bx + 1]
     65     mov es : [si + 2], al
     66     mov byte ptr es : [si + 3], 02h
     67     mov al, [bx + 2]
     68     mov es : [si + 4], al
     69     mov byte ptr es : [si + 5], 02h
     70     mov al, [bx + 3]
     71     mov es : [si + 6], al
     72     mov byte ptr es : [si + 7], 02h
     73 
     74     mov ax, [bx + 84]
     75     mov dx, [bx + 86]
     76     add si, 20
     77     call changeToStr
     78     
     79     mov ax, [di + 168]
     80     mov dx, 0
     81     add si, 20
     82     call changeToStr
     83     
     84 
     85     mov dx, [bx + 86]
     86     mov ax, [bx + 84]
     87     push cx
     88     mov cx, [di + 168]
     89     add si, 20
     90     call divdw
     91     push ax
     92     mov ax, dx
     93     call changeToStr
     94     pop ax
     95     call changeToStr
     96     sub si, 60
     97     pop cx
     98 
     99 
    100     add bx, 4
    101     add di, 2
    102     add si, 160
    103     loop s
    104 
    105     mov ax, 4c00h
    106     int 21h
    107 
    108 codesg ENDS
    109 END start

    在虚拟机中把int 21h 变成jmp $则显示上图,基本实现实验。刚刚发现不需要jmp $来死循环,想想也是,改变的是显存,程序结束没有别的因素改变显存,依旧显示。

  • 相关阅读:
    实验四 Android开发基础
    20135322实验五实验报告
    Eclipse中Ant的配置与测试
    实验三 敏捷开发与XP实践
    实验二 Java面向对象程序设计
    Java实验报告一:Java开发环境的熟悉
    简单四则运算
    个人介绍
    团队冲刺第一阶段个人工作总结2
    团队冲刺第一阶段个人工作总结1
  • 原文地址:https://www.cnblogs.com/ACystalMoon/p/2759636.html
Copyright © 2011-2022 走看看