⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 56.asm

📁 汇编语言课后习题答案
💻 ASM
字号:
;56.asm

datasg   segment
  m      db  1,2,3,4,5,6,7,8,9,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10
  p      db  20 dup(?)
  countp db  'positive data:',?,?,13,10,'$'
  n      db  20 dup(?)
  countn db  'negative data:',?,?,13,10,'$'
datasg   ends

codesg   segment
         assume  cs:codesg,ds:datasg
main     proc    far
start:
         push ds
         sub  ax,ax
         push ax

         mov  ax,datasg
         mov  ds,ax

         mov cx,20
         mov bx,0
         mov si,bx
         mov di,bx

loop1:   cmp m[bx],0
         jg  positive
         jl  negative
         jmp short next

positive:mov al,m[bx]
         mov p[si],al
         inc si
         jmp short next

negative:mov al,m[bx]
         mov n[di],al
         inc di

next:    inc bx
         loop loop1

         mov bl,10d
         mov ax,si
         div bl
         add ax,3030h
         mov [countp+14],al
         mov [countp+15],ah

         mov ax,di
         div bl
         add ax,3030h
         mov [countn+14],al
         mov [countn+15],ah

         lea dx,countp
         mov ah,09
         int 21h

         lea dx,countn
         mov ah,09
         int 21h
         ret
main     endp
codesg   ends
         end  start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -