Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; goto compile
- .model tiny
- .386
- .code
- org 100h
- _:
- mov bx, 0
- mov ds, bx
- mov ax, 0003h
- int 10h
- dump:
- push ds
- push bx
- call print_screen
- pop bx
- pop ds
- listening:
- mov ax, 0
- int 16h
- cmp ah, 01h
- je reboot
- cmp ah, 48h
- je up
- cmp ah, 50h
- je down
- cmp ah, 49h
- je pgup
- cmp ah, 51h
- je pgdn
- jmp listening
- reboot:
- mov ax, 0003h
- int 19h
- up:
- sub bx, 010h
- jmp dump
- down:
- add bx, 010h
- jmp dump
- pgup:
- mov ax, ds
- dec ax
- mov ds, ax
- jmp dump
- pgdn:
- mov ax, ds
- inc ax
- mov ds, ax
- jmp dump
- init:
- mov ax, 0b800h
- mov es, ax
- mov di, 0
- mov dx, 160
- mov cx, 25
- cld
- ret
- print_screen:
- call init
- repeat:
- push bx
- call print_hex_line
- pop bx
- call print_line
- mov di, dx
- add dx, 160
- loop repeat
- ret
- print_line:
- call print_pipe
- push cx
- mov cx, 8
- data:
- mov ax, word ptr [ds:bx]
- xchg ah, al
- call print_word
- add bx, 2
- loop data
- pop cx
- call print_pipe
- ret
- print_word:
- push ax
- xchg ah, al
- call print_al
- pop ax
- call print_al
- ret
- print_al:
- mov ah, 0Fh
- stosw
- ret
- print_hex_line:
- mov ax, ds
- call print_word_hex
- call print_colon
- mov ax, bx
- call print_word_hex
- call print_pipe
- call print_space
- push cx
- mov cx, 8
- data_hex:
- mov ax, word ptr [ds:bx]
- xchg ah, al
- call print_word_hex
- call print_space
- add bx, 2
- loop data_hex
- pop cx
- ret
- print_pipe:
- mov ax, 0F7Ch
- stosw
- ret
- print_space:
- mov ax, 0
- stosw
- ret
- print_colon:
- mov al, 58
- mov ah, 0Fh
- stosw
- ret
- print_word_hex:
- push ax
- xchg ah, al
- call print_hex_al
- pop ax
- call print_hex_al
- ret
- print_hex_al:
- push ax
- push cx
- mov cl, 4
- shr al, cl
- pop cx
- call print_hex_digit
- pop ax
- call print_hex_digit
- ret
- print_hex_digit:
- push ax
- and al, 0Fh
- cmp al, 10
- sbb al, 69h
- das
- mov ah, 0Fh
- stosw
- pop ax
- ret
- last:
- db (510 - (last - _)) dup(0)
- db 55h, 0AAh
- end _
- ; :compile
- ; tasm /m dumper.bat
- ; tlink /x/t dumper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement