📄 deppack.nas
字号:
;;
;; aPLib compression library - the smaller the better :)
;;
;; NASM 16bit assembler depacker example
;;
;; Copyright (c) 1998-2002 by Joergen Ibsen / Jibz
;; All Rights Reserved
;;
;; -> 16bit by Metalbrain (metalbrain_coder@gmx.net)
;;
org 256
cld ;Clear direction flag for safety
mov ah,4ah ;Modify memory block size (on start,
; the .COM program is given all free
; memory, but this could be less than
; the needed amount (162K). As a nice
; side effect, we are freeing unused
; memory, but who cares under DOS?
mov bh,41 ;Number of needed paragraphs
; (rounded up)
int 33 ;Resize
jnc not_error008 ;Continue if no error
call final ;Exit with message below
db "Not enough memory$"
not_error008 mov si,129 ;Arguments from PSP start here
pop cx ;CX=0 (useful later)
mov di,testitnow ;This will be called quite a few times
; and later will be used to place
; variables
mov bx,rub+1
space1 mov dx,si ;Keep it start infile name in DX
call di ;Parse...
jz space1 ;Search for non-space
space2 call di ;Keep parsing
jnz space2 ;Till a space appears
mov [si-1],dh ;Make infile ASCIIZ
space3 push si ;Keep start outfile name in stack
call di ;Still parsing
jz space3 ;Now search a non-space again
mov [unitoutfile],al;Set unit for temporal outfile
space4 lodsb ;Final parse
cmp al,":" ;Is there's a unit in outfile name?
jnz nounit ;No-> skip next
sub byte [bx],bh ;Yes-> temporal outfile includes unit
nounit cmp al," "
ja space4 ;Space or below means end of filename
mov [si-1],dh ;Make ASCIIZ this one too
mov ax,3d00h ;Function to open infile
int 33 ;Open infile
jnc not_error001 ;Continue if no error
call final ;Exit with message below
db "Can't open infile$"
not_error001 stosw ;Store infile handle at handlein
pushad
mov dx,header
mov cl,8 ;Header first part
mov bh,3fh
xchg ax,bx
int 33 ;Read 1st part header. No error check
cmp dword [header],'AP32'
jz not_error009 ;Test for bad infile #3: Header
call final
err004 db "Bad infile$"
not_error009 mov cx,[headersize]
sub cx,byte 8
mov ah,3fh
int 33 ;Read 2nd part header
popad
mov dx,[bx] ;Get outfile name position
mov ah,3ch
int 33 ;Create temporal outfile: "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -