码迷,mamicode.com
首页 > 编程语言 > 详细

汇编语言-打印部分ASCII表

时间:2014-05-21 04:49:22      阅读:379      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   c   code   java   

  用表格形式显示字符

1. 题目:用表格形式显示ASCII字符

2.要求:按15行×16列的表格形式显示ASCII码为10H-100H的所有字符,即以行为主的顺序及ASCII码递增的次序依次显示对应的字符。每16个字符为一行,每行中的相邻两个字符之间用空白符或空格符(ASCII码为0或20H)隔开

由于ASCII表127后面的字符是不可打印字符,键盘上找不到,故打印为????

代码如下:

bubuko.com,布布扣
 1 ; Example assembly language program --
 2 ; Author:  Karllen
 3 ; Date:    revised 05/2014
 4 
 5 .386
 6 .MODEL FLAT
 7 
 8 ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
 9 
10 INCLUDE io.h            ; header file for input/output
11 
12 cr      EQU     0dh     ; carriage return character
13 Lf      EQU     0ah     ; line feed
14 
15 .STACK  4096            ; reserve 4096-byte stack
16         
17 .DATA                   ; reserve storage for data
18       
19        promot  BYTE  "The program is to print Ascii from 10h to 100h",cr,Lf,0
20        line    DWORD  ?
21        row     DWORD  ?
22        ccf     BYTE   " ",0
23        crlf    BYTE   cr,Lf,0
24        char    BYTE   1 DUP(?)
25            
26 .CODE                           ; start of main program code
27 _start:
28        output  promot
29        mov     row,0
30        mov     line,0
31        mov     char,0Fh
32        doFirstWhile:
33               inc line
34               cmp line,15
35               jg  endFirstWhile
36               mov row,0
37               doSecondWhile:
38                      inc row
39                      cmp row,16
40                      jg  endSecondWhile
41                      add char,1
42                      output char
43                      output ccf
44                      jmp  doSecondWhile
45               endSecondWhile:
46                      output crlf
47                      jmp  doFirstWhile
48         endFirstWhile:
49         
50         INVOKE  ExitProcess, 0  ; exit with return code 0
51 
52 PUBLIC _start                   ; make entry point public
53 
54 END                             ; end of source code
bubuko.com,布布扣

 运行结果查看

 

 

 

 

 

bubuko.com,布布扣

汇编语言-打印部分ASCII表,布布扣,bubuko.com

汇编语言-打印部分ASCII表

标签:style   blog   class   c   code   java   

原文地址:http://www.cnblogs.com/Forever-Kenlen-Ja/p/3739441.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!