Advertisement
FlyFar

decompress.asm

Mar 21st, 2023
1,113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 0.70 KB | Cybersecurity | 0 0
  1. mov bx, daddr
  2. mov es, bx
  3. mov ds, bx
  4.  
  5. ; Read from disk
  6. mov ax, 0x0204
  7. mov cx, 0x0002
  8. mov dh, 0
  9. mov bx, compressed
  10. int 13h
  11.  
  12. xor ax, ax
  13. mov bx, ax
  14. mov cx, ax
  15. mov dx, ax
  16.  
  17. mov si, compressed
  18. mov di, image
  19.  
  20. readcommand:
  21.     lodsb
  22.    
  23.     cmp si, compressed+compsize
  24.     jae startanimation
  25.    
  26.     cmp al, 128
  27.     jae newdata
  28.     jmp olddata
  29.    
  30. newdata:
  31.     and al, 127
  32.     mov cl, al
  33.    
  34.     newnextbyte:
  35.         lodsb
  36.         stosb
  37.        
  38.         dec cl
  39.         cmp cl, -1
  40.         jne newnextbyte
  41.        
  42.         jmp readcommand
  43.        
  44. olddata:
  45.     mov ah, al
  46.     lodsb
  47.    
  48.     mov bx, ax
  49.     lodsb
  50.    
  51.     mov dx, si
  52.     mov si, bx
  53.     add si, image
  54.     mov cl, al
  55.    
  56.     oldnextbyte:
  57.         lodsb
  58.         stosb
  59.        
  60.         dec cl
  61.         cmp cl, 0
  62.         jne oldnextbyte
  63.        
  64.         mov si, dx
  65.         jmp readcommand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement