《汇编语言》王爽著-第3版--各种实验

实验4.2

opooc segment
    mov ax,20h
    mov ds,ax
    mov bx,1


    mov cx,3fh
l:  mov [bx],bl
    inc bx
    loop l

    mov ax,4c00h
    int 21h
opooc ends
end

实验 4.3

opooc segment
    mov ax,076Ah
    mov ds,ax
    mov ax,0020h
    mov es,ax
    mov bx,0
    mov cx,1dh
s:  mov al,[bx]
    mov es:[bx],al
    inc bx
    loop s
    mov ax,4c00h
    int 21h
opooc ends
end
~    

实验5.1

data segment
        dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
data ends
stack segment
    dw 0,0,0,0,0,0,0,0
stack ends
code segment
start: mov ax,stack
    mov ss,ax
    mov sp,16

    mov ax,data
    mov ds,ax

    push ds:[0]
    push ds:[2]
    pop ds:[2]
    pop ds:[0]

    mov ax,4c00h
    int 21h
code ends

实验5.2

        dw 0123h,0456h
data ends
stack segment
    dw 0,0
stack ends
code segment
start: mov ax,stack
    mov ss,ax
    mov sp,16

    mov ax,data
    mov ds,ax

    push ds:[0]
    push ds:[2]
    pop ds:[2]
    pop ds:[0]

    mov ax,4c00h
    int 21h
code ends
end start

实验5.3

code segment
    start: mov ax,stack
    mov ss,ax
    mov sp,16

    mov ax,data
    mov ds,ax

    push ds:[0]
    push ds:[2]
    pop ds:[2]
    pop ds:[0]

    mov ax,4c00h
    int 21h
code ends
data segment
    dw 0123h,0456h
data ends
stack segment
    dw 0,0
stack ends

end start
~                   

实验5.5

a segment
    db 1,2,3,4,5,6,7,8
a ends

b segment
    db 1,2,3,4,5,6,7,8
b ends

c segment
    db 0,0,0,0,0,0,0,0
c ends

code segment
start: mov bx,0
       mov cx,8
     s:mov ax,a
       mov ds,ax
       mov dl,[bx]
       mov ax,b
       mov ds,ax
       add dl,[bx]
       mov ax,c
       mov ds,ax
       mov [bx],dl
       inc bx
       loop s
code ends
end start

实验5.6

  
a segment
    dw 1,2,3,4,5,6,7,8,9
a ends

b segment
    dw 0,0,0,0,0,0,0,0,0
b ends
code segment
start: mov ax,a
       mov ds,ax
       mov bx,0
       mov ax,b
       mov ss,ax
       mov sp,10h
       mov cx,8
     l:push [bx]
       add bx,2
       loop l
code ends
end start

实验7

data segment
    db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
    db '1984','1985','1986','1987','1988','1989','1990','1991','1992'
    db '1993','1994','1995'

    dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
    dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000

    dw 3,7,9,13,28,38,130,220,476,778,100,1442,2258,2793,4037,5635,8226
    dw 11542,14430,15257,17800
data ends
table segment
    db 21 dup('year summ ne ?? ')
table ends
codesg segment
start:mov ax,data
      mov ds,ax
      mov ax,table
      mov es,ax

      mov bx,0
      mov si,0
      mov di,0
      mov bp,0

      mov cx,21
   l: mov al,[bx]
      mov es:[bp+0+si],al
      inc si
      inc bx
      mov al,[bx]
      mov es:[bp+0+si],al
      inc si
      inc bx
      mov al,[bx]
      mov es:[bp+0+si],al
      inc si
      inc bx
      mov al,[bx]
      mov es:[bp+0+si],al
      inc bx

      add bp,10h
      mov si,0
      loop l

      mov bp,0
      mov cx,21
   l1:mov ax,[bx]
      mov es:[bp+5+si],ax
      add si,2
      add bx,2

      mov ax,[bx]
      mov es:[bp+5+si],ax
      add bx,2

      add bp,10h
      mov si,0
      loop l1

      mov bp,0
      mov cx,21
   l2:mov ax,[bx]
      mov es:[bp+10+si],ax
      add bx,2

      add bp,10h
      loop l2

      mov bp,0
      mov cx,9
   l3:mov ax,es:[bp+5+si]
      div byte ptr es:[bp+10+si]
      mov es:[bp+13+si],si
      mov es:[bp+13+si],al

      add bp,10h
      loop l3

      mov cx,12
   l4:mov ax,es:[bp+5+si]
      mov dx,es:[bp+7+si]
      div word ptr es:[bp+10+si]
      mov es:[bp+13+si],ax

      add bp,10h
      loop l4

      mov ax,4c00h
      int 21h

codesg ends
end start

实验8

codesg segment
        mov ax,4c00h
        int 21h
start:  mov ax,0
    s:  nop
        nop

        mov di,offset s
        mov si,offset s2
        mov ax,cs:[si]
        mov cs:[di],ax
  s0:   jmp short s

  s1:   mov ax,0
        int 21h
        mov ax,0

  s2:   jmp short s1
        nop
codesg ends
end start
~            

实验9

codesg segment
        mov ax,4c00h
        int 21h
start:  mov ax,0
    s:  nop
        nop

        mov di,offset s
        mov si,offset s2
        mov ax,cs:[si]
        mov cs:[di],ax
  s0:   jmp short s

  s1:   mov ax,0
        int 21h
        mov ax,0

  s2:   jmp short s1
        nop
codesg ends
end start
~          

实验10


data segment
        db 'Hello  World !!!'
        db 02h,24h,71h
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,10h

        xor bx,bx   ;索引颜色
        mov ax,0b872h; w起始

        mov cx,3
     s3:push cx
        push ax
        push bx

        mov es,ax

        mov si,0;索引字符列
        mov di,0;索引屏幕字符串

        mov cx,10h
     s1:mov al,ds:[si]
        mov es:[di],al
        inc si
        add di,2
        loop s1

        mov di,1
        pop bx
        mov al,ds:[bx+10h]
        inc bx

        mov cx,10h
     s2:mov es:[di],al
        add di,2
        loop s2

        pop ax
        add ax,0ah

        pop cx
        loop s3

        mov ax,4c00h
        int 21h
code ends
end start
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值