1/* 2; i086-dos16.sys.S -- loader & decompressor for the dos/sys format 3; 4; This file is part of the UPX executable compressor. 5; 6; Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer 7; Copyright (C) 1996-2020 Laszlo Molnar 8; All Rights Reserved. 9; 10; UPX and the UCL library are free software; you can redistribute them 11; and/or modify them under the terms of the GNU General Public License as 12; published by the Free Software Foundation; either version 2 of 13; the License, or (at your option) any later version. 14; 15; This program is distributed in the hope that it will be useful, 16; but WITHOUT ANY WARRANTY; without even the implied warranty of 17; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18; GNU General Public License for more details. 19; 20; You should have received a copy of the GNU General Public License 21; along with this program; see the file COPYING. 22; If not, write to the Free Software Foundation, Inc., 23; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24; 25; Markus F.X.J. Oberhumer Laszlo Molnar 26; <markus@oberhumer.com> <ezerotven+github@gmail.com> 27; 28*/ 29 30#define SYS 1 31#define COM 0 32#define CJT16 1 33#include "arch/i086/macros.S" 34 35 36/* 37; ============= 38; ============= ENTRY POINT 39; ============= 40*/ 41 42section SYSMAIN1 43start: 44 .long -1 45 .short attribute 46 .short strategy /* .sys header */ 47 .short interrupt /* opendos wants this field untouched */ 48strategy: 49section SYSI2861 50 CPU 286 51 pusha 52 CPU 8086 53section SYSI0861 54 push ax 55 push bx 56 push cx 57 push dx 58 push si 59 push di 60 push bp 61section SYSMAIN2 62 mov si, offset copy_source 63 mov di, offset copy_destination 64 65 mov cx, si /* at the end of the copy si will be 0 */ 66 67 push es 68 push ds 69 pop es 70 71 std 72 rep 73 movsb 74 cld 75 76 mov bx, 0x8000 77 78 xchg di, si 79 .byte 0x83, 0xee, neg_e_len /* sub si, xxx -- sets bit C for sbb below */ 80section SYSSBBBP 81 sbb bp, bp 82section SYSCALLT 83 push di 84section SYSMAIN3 85 jmp decomp_start_n2b 86 87#include "include/header.S" 88 89section SYSCUTPO 90 91#include "arch/i086/nrv2b_d16.S" 92 93section SYSMAIN5 94 pop es 95section SYSI2862 96 CPU 286 97 popa 98 CPU 8086 99section SYSI0862 100 pop bp 101 pop di 102 pop si 103 pop dx 104 pop cx 105 pop bx 106 pop ax 107section SYSJUMP1 108 jmp original_strategy 109 110/* vim:set ts=8 sw=8 et: */ 111