Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .model tiny
  2.     .386
  3.     .code
  4.     org 100h
  5.  
  6. Start:
  7.     mov ah, 0Fh
  8.     int 10h
  9.     mov byte ptr screenWidth, ah
  10.     mov byte ptr mode, al
  11.     sub ah, 39
  12.     shr ah, 1
  13.     mov byte ptr leftPart, ah
  14.     mov ah, byte ptr screenWidth
  15.     sub ah, byte ptr leftPart
  16.     sub ah, 39
  17.     mov byte ptr rightPart, ah
  18.  
  19.     mov bl, 00011110b
  20.     xor dx, dx
  21.     mov ax, 0B800h
  22.     mov es, ax
  23.     xor di, di
  24.     jmp Main
  25.  
  26. screenWidth db ?
  27. leftPart    db ?
  28. rightPart   db ?
  29. mode    db ?
  30. leftCorner  db ?
  31. middlePipe  db ?
  32. rightCorner db ?
  33.  
  34. whiteSpaces proc
  35.     xor ax, ax
  36.     mov al, byte ptr screenWidth
  37.     mov cx, 3
  38.     mul cx
  39.     mov cx, ax
  40.     mov ah, 1Fh
  41.     mov al, 32
  42.     rep stosw
  43.     ret
  44. whiteSpaces endp
  45.  
  46. frameLine proc
  47.     mov cl, byte ptr leftPart
  48.     rep stosw
  49.     mov al, byte ptr leftCorner
  50.     stosw
  51.     mov al, 205
  52.     mov cl, 3
  53.     rep stosw
  54.     mov al, byte ptr middlePipe
  55.     stosw
  56.     mov al, 205
  57.     mov cl, 33
  58.     rep stosw
  59.     mov al, byte ptr rightCorner
  60.     stosw
  61.     mov al, 32
  62.     mov cl, byte ptr rightPart
  63.     rep stosw
  64.     ret
  65. frameLine endp
  66.  
  67. Main:
  68.     call whiteSpaces
  69.  
  70.     mov byte ptr leftCorner, 201
  71.     mov byte ptr middlePipe, 203
  72.     mov byte ptr rightCorner, 187
  73.     call frameLine
  74.  
  75.     mov cl, byte ptr leftPart
  76.     rep stosw
  77.     mov al, 186
  78.     stosw
  79.     mov al, 32
  80.     mov cl, 3
  81.     rep stosw
  82.     mov al, 186
  83.     stosw
  84.     mov al, 32
  85.     stosw
  86.     mov al, 48
  87. numbers:
  88.     stosw
  89.     push ax
  90.     mov al, 32
  91.     stosw
  92.     pop ax
  93.     inc al
  94.     cmp al, 58
  95.     jl numbers
  96.     mov al, 65
  97. letters:
  98.     stosw
  99.     push ax
  100.     mov al, 32
  101.     stosw
  102.     pop ax
  103.     inc ax
  104.     cmp al, 71
  105.     jl letters
  106.     mov al, 186
  107.     stosw
  108.     mov al, 32
  109.     mov cl, byte ptr rightPart
  110.     rep stosw
  111.  
  112.     mov byte ptr leftCorner, 204
  113.     mov byte ptr middlePipe, 206
  114.     mov byte ptr rightCorner, 185
  115.     call frameLine
  116.     mov dl, 48
  117.     xor al, al
  118.  
  119. print_table:
  120.     push ax
  121.     mov al, 32
  122.     mov cl, byte ptr leftPart
  123.     rep stosw
  124.     mov al, 186
  125.     stosw
  126.     mov al, 32
  127.     stosw
  128.     mov al, dl
  129.     stosw
  130.     inc dl
  131.     cmp dl, 58
  132.     jne continue_printing
  133.     mov dl, 65
  134. continue_printing:
  135.     mov al, 32
  136.     stosw
  137.     mov al, 186
  138.     stosw
  139.     mov al, 32
  140.     stosw
  141.     mov cx, 16
  142. table_loop:
  143.     pop ax
  144.     stosw
  145.     inc al
  146.     push ax
  147.     mov al, 32
  148.     stosw
  149.     dec cx
  150.     jnz table_loop
  151.     mov al, 186
  152.     stosw
  153.     mov al, 32
  154.     mov cl, byte ptr rightPart
  155.     rep stosw
  156.     pop ax
  157.     cmp dl, 71
  158.     jl print_table
  159.  
  160.     mov byte ptr leftCorner, 200
  161.     mov byte ptr middlePipe, 202
  162.     mov byte ptr rightCorner, 188
  163.     call frameLine
  164.     call whiteSpaces
  165.  
  166. end_print:
  167.     mov dh, 25
  168.     xor dl, dl
  169.     mov ah, 02h
  170.     int 10h
  171.  
  172.     xor ax, ax
  173.     int 16h
  174.     xor ax, ax
  175.     mov al, byte ptr mode
  176.     int 10h
  177.     ret
  178.  
  179. end Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement