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

📄 1.asm

📁 2. 在显示九九表时有十种颜色变化如:按0—9键分别对应有十种不同颜色1. 二进制转换十进制的显示子程序能自动消除高位的0
💻 ASM
字号:
SSEG   SEGMENT   PARA   STACK   'stack'   
            dw   100h   dup(0)   ;Resize   the   stack   by   changing   the   number   '100'   
  SSEG   ENDS   
    
  DSEG   SEGMENT   
        ;TO   DO:   Add   your   program's   data   here   
  datas   db   100   dup(?)   
  datanum   dw   0   
  ro   db   0   
  f_printf1   dw   0;the   number   to   print   
  f_printf2   dw   0   
    
  DSEG   ENDS   
    
  CSEG   SEGMENT   
      assume     cs:CSEG,   ds:DSEG,   es:DSEG,   ss:SSEG   
        
      INIT   PROC   ;Initialize   procedure   
      mov   ax,   dseg   
  mov   ds,   ax   
  mov   es,   ax   
  ;TO   DO:   Add   your   initialize   code   here   (as   your   requirement)   
    
  ret         ;return   to   the   MAIN   procedure   
      INIT   ENDP   
    
      MAIN   PROC       ;Here   is   your   program   entry   point   
      call   INIT   ;call   the   INIT   procedure   to   initialize   the   program   
      ;**TO   DO:   Add   your   main   code   here**   
    
  mov   datanum   ,2   
  mov   di   ,1   
  mov   datas[di]   ,1   
  mov   di   ,2   
  mov   datas[di]   ,1   
    
  mov   ah   ,1   
  int   21h   
  sub   al   ,30h   
  mov   ro   ,al   
    
  mov   f_printf2   ,2   
  ;cmp   al   ,5   
  ;jb   judgeend   
  add   f_printf2   ,2   
    
  judgeend:   
  mov   bh   ,1   
    
  mov   ah   ,2   
  mov   dl   ,0dh   
  int   21h   
  mov   ah   ,2   
  mov   dl   ,0ah   
  int   21h   
    
  mov   di   ,1   
    
  mov   cx   ,40   
  sub   cx,datanum   
  point0:   
  mov   ah   ,2   
  mov   dl   ,20h   
  int   21h   
  dec   cx   
  cmp   cx   ,1   
  jne   point0   
    
  mov   dl   ,datas[di]   
  ;add   dl   ,30h   
  mov   dh   ,0   
  mov   f_printf1   ,dx   
  call   printf   
  ;mov   ah   ,2   
  ;int   21h   
  ;mov   dl   ,20h   
  ;int   21h   
  mov   di   ,2   
  mov   dl   ,datas[di]   
  ;add   dl   ,30h   
  mov   dh   ,0   
  mov   f_printf1   ,dx   
  call   printf   
  ;int   21h   
    
  mov   ah   ,2   
  mov   dl   ,0dh   
  int   21h   
  mov   ah   ,2   
  mov   dl   ,0ah   
  int   21h   
    
  po:   
  mov   cx   ,40   
  sub   cx,datanum   
  sub   cx,datanum   
  mov   ah   ,2   
  mov   dl   ,20h   
  point1:   
  int   21h   
  dec   cx   
  cmp   cx   ,1   
  jne   point1   
    
    
    
  mov   cx   ,datanum   
  point2:   
  mov   di   ,cx   
  mov   bl   ,datas[di]   
  sub   di   ,1   
  add   bl   ,datas[di]   
  add   di   ,1   
  mov   datas[di]   ,bl   
  sub   cx   ,1   
  cmp   cx   ,1   
  jne   point2   
    
  mov   di   ,1   
  mov   datas[di]   ,1   
  inc   datanum   
  mov   di   ,datanum   
  mov   datas[di]   ,1   
    
  mov   di   ,1   
  point3:   
  mov   dl   ,datas[di]   
  ;add   dl   ,30h   
  mov   dh   ,0   
  mov   f_printf1   ,dx   
  call   printf   
  ;mov   ah   ,2   
  ;int   21h   
    
  ;mov   dl   ,20h   
  ;mov   ah   ,2   
  ;int   21h   
    
  inc   di   
  cmp   di   ,datanum   
  jbe   point3   
    
  mov   ah   ,2   
  mov   dl   ,0dh   
  int   21h   
  mov   ah   ,2   
  mov   dl   ,0ah   
  int   21h   
    
  ;mov   ah   ,1   
  ;int   21h   
    
  ;mov   dl   ,bh   
  ;mov   ah   ,2   
  ;int   21h   
    
  add   bh   ,1   
  cmp   bh   ,ro   
  jb   po   
    
  mov   ax,   4c00h     ;The   end   of   the   program,   return   to   the   system   
      int   21h   
      MAIN   ENDP   
      ;TO   DO:   Add   other   procedures(PROC)   here   (as   your   requirement)   
        
      printf   proc   near   
      push   ax   
      push   bx   
      push   cx   
      push   dx   
        
      mov   bl   ,10   
      mov   ax   ,f_printf1   
      mov   bh   ,0   ;the   number   of   the   f_printf1   
  printfpoint1:   
              div   bl   
      mov   ch   ,0   
      mov   cl   ,ah   
      push   cx   
      inc   bh   
  mov   ah   ,0   
  cmp   al   ,0   
  jne   printfpoint1   
    
  mov   cx   ,f_printf2   
  sub   cl   ,bh   
  cmp   cl   ,0   
  je   printfpoint3   
  mov   ah   ,2   
  mov   dl   ,20h   
  printfpoint2:   
  int   21h   
  dec   cl   
  cmp   cl   ,0   
  jne   printfpoint2   
    
    
  printfpoint3:   
  pop   dx   
  add   dl,30h   
  mov   ah   ,2   
  int   21h   
  dec   bh   
  cmp   bh   ,0   
  jne   printfpoint3   
    
        
      pop   dx   
      pop   cx   
      pop   bx   
      pop   ax   
      ret   
  printf   endp   
    
  CSEG   ENDS   
  ;TO   DO:   Add   other   segments   here   (as   your   requirement)   
    
  END   MAIN   

⌨️ 快捷键说明

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