wok diff dev86/stuff/com2exe @ rev 13117

dev86: add com2exe
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jul 01 13:52:12 2012 +0200 (2012-07-01)
parents
children a13a6c5b176e
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dev86/stuff/com2exe	Sun Jul 01 13:52:12 2012 +0200
     1.3 @@ -0,0 +1,10 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +[ ! -s "$1" ] && echo "Usage: $0 file.com > file.exe" && exit 1
     1.7 +S=$(stat -c %s $1)
     1.8 +P=$((($S+511)/512))
     1.9 +E=$((4096-(32*$P)))
    1.10 +for i in 0x5A4D $(($S%512)) $P 0 2 $E $E -16 -2 0 256 -16 28 0 0 0
    1.11 +do printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255)) | xargs echo -en
    1.12 +done
    1.13 +cat $1