Advertisement
Guest User

Untitled

a guest
Mar 10th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; goto compile
  2.     .model tiny
  3.     .386
  4.     .code
  5.     org 100h
  6.  
  7. _:
  8.     mov bx, 0
  9.     mov ds, bx    
  10.     mov ax, 0003h
  11.     int 10h
  12.  
  13. dump:
  14.     push ds
  15.     push bx
  16.     call print_screen
  17.     pop bx
  18.     pop ds
  19.  
  20. listening:
  21.     mov ax, 0
  22.     int 16h
  23.  
  24.     cmp ah, 01h
  25.     je reboot
  26.  
  27.     cmp ah, 48h
  28.     je up
  29.  
  30.     cmp ah, 50h
  31.     je down
  32.  
  33.     cmp ah, 49h
  34.     je pgup
  35.  
  36.     cmp ah, 51h
  37.     je pgdn
  38.  
  39.     jmp listening
  40.  
  41. reboot:
  42.     mov ax, 0003h
  43.     int 19h
  44. up:
  45.     sub bx, 010h
  46.     jmp dump
  47. down:
  48.     add bx, 010h
  49.     jmp dump
  50. pgup:
  51.     mov ax, ds
  52.     dec ax
  53.     mov ds, ax
  54.     jmp dump
  55. pgdn:
  56.     mov ax, ds
  57.     inc ax
  58.     mov ds, ax
  59.     jmp dump
  60.  
  61. init:
  62.     mov ax, 0b800h
  63.     mov es, ax
  64.     mov di, 0
  65.     mov dx, 160
  66.     mov cx, 25
  67.     cld
  68.     ret
  69.  
  70. print_screen:
  71.     call init
  72.     repeat:
  73.     push bx
  74.         call print_hex_line
  75.     pop bx
  76.         call print_line
  77.  
  78.         mov di, dx
  79.         add dx, 160
  80.         loop repeat
  81.     ret
  82.  
  83. print_line:
  84.     call print_pipe
  85.     push cx
  86.     mov cx, 8
  87.     data:
  88.         mov ax, word ptr [ds:bx]
  89.         xchg ah, al
  90.         call print_word
  91.         add bx, 2
  92.         loop data
  93.     pop cx
  94.     call print_pipe
  95.     ret
  96.  
  97. print_word:
  98.     push ax
  99.     xchg ah, al
  100.     call print_al
  101.     pop ax
  102.     call print_al
  103.     ret
  104.  
  105. print_al:
  106.     mov ah, 0Fh
  107.     stosw
  108.     ret
  109.  
  110. print_hex_line:
  111.     mov ax, ds
  112.     call print_word_hex
  113.     call print_colon
  114.  
  115.     mov ax, bx
  116.     call print_word_hex
  117.     call print_pipe
  118.     call print_space
  119.     push cx
  120.     mov cx, 8
  121.     data_hex:
  122.         mov ax, word ptr [ds:bx]
  123.         xchg ah, al
  124.         call print_word_hex
  125.     call print_space
  126.         add bx, 2
  127.         loop data_hex
  128.     pop cx
  129.     ret
  130.  
  131. print_pipe:
  132.     mov ax, 0F7Ch
  133.     stosw
  134.     ret
  135.  
  136. print_space:
  137.     mov ax, 0
  138.     stosw
  139.     ret
  140.  
  141. print_colon:
  142.     mov al, 58
  143.     mov ah, 0Fh
  144.     stosw
  145.     ret
  146.  
  147. print_word_hex:
  148.     push ax
  149.     xchg ah, al
  150.     call print_hex_al
  151.     pop ax
  152.     call print_hex_al
  153.     ret
  154.  
  155. print_hex_al:
  156.     push ax
  157.     push cx
  158.     mov cl, 4
  159.     shr al, cl
  160.     pop cx
  161.     call print_hex_digit
  162.     pop ax
  163.     call print_hex_digit
  164.     ret
  165.  
  166. print_hex_digit:
  167.     push ax
  168.     and al, 0Fh
  169.     cmp al, 10
  170.     sbb al, 69h
  171.     das
  172.     mov ah, 0Fh
  173.     stosw
  174.     pop ax
  175.     ret
  176.  
  177. last:
  178.     db (510 - (last - _)) dup(0)
  179.     db 55h, 0AAh
  180. end _
  181. ; :compile
  182. ;   tasm /m dumper.bat
  183. ;   tlink /x/t dumper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement