XPost: alt.lang.asm, comp.os.msdos.programmer   
   From: admin@nospicedham.127.0.0.1   
      
   On Mon, 13 Feb 2023 22:31:01 +0000   
   "Kerr-Mudd, John" wrote:   
      
   > Many years (decades actually) ago a one time regular here, Laura   
   > Fairhead, posted a com to ascii program, called CM3. I've gone back to   
   > looking at the decoder and have failed to find any way of shortening   
   > it. But I've revamped the "create" program to just output ASCII code   
   > (dropping the batch surrounds of 'Echo/' and '>>fn.com') from 759   
   > bytes to 394 and made another that outputs the encoded program to STDOUT   
   > (rather than immediately executing), that one's a bit shorter at 376.   
   > As they are just variations on a theme, the same restriction applies:   
   > max com file input size is c.50k. (one read, one write)   
   >   
   > Here they are: (encoded by the 2nd program), so save to file & run to   
   > recreate - feel free to step through them and run a virus scanner 1st!   
   > I can post debug dumps if preferred.   
   >   
   > 1) Program to convert a DOS COM file to ASCII executable;   
   >   
   > to recreate the binary copy and paste to 'prog1.com' or somesuch then run   
   > prog1 >makeexec.com   
   >   
   > usage is makeexec dosprog.com > asciexec.com   
   >   
   > 'asciexec' can then be run as if it were 'dosprog'   
   >   
   > 6h}aXP5y`P]4nP_XW(F4(F6(F=(FF)FH(FL(Fe(FR0FTs*}`A?+,   
   > fkOU):G*@Crv,*t$HU[rlf~#IubfRfXf(V#fj}fX4{PY$@fPfZsZsX2YVQH   
   > .+HWM4LVC4qsv9[T}uqrxB`h3HS(iNkBgUa,2bfa'Yfx0bVQ$W-N*$')=0i   
   > EsLo$7E1_dORw$Mt`cNhc93c_get+f\YtWI,@;yVnT[jd=`*nGHUS)t/39(   
   > W`ST7T;)K(?j'?/:u1:e`4r(rTZII0$$o6DI$(bI$$))7$$[v:I)zKNqgwJ   
   > ID@a~-P;?}fF[dC3:CQwk9bqei2[pHR2[pHR@zd6:96}tJ)9`RMDsTh=N;P   
   > 4g_c'icT(vo7blJ:}btejaUFXW8@`Voq$W5O$$)HhXt5HK_AQ}-bHn{290K   
   > (H,HYn9aHn~4@Mgsk(0Ca;@=6,QOBN\6oIsHQRMCN37GUe[2MCN96KPrz4H   
   > YwfpIVK4]Any3ZAomX0Aq?/y2{,T`=V\.g9cxp`3=Xk[=V\m{HVd-H5U-Go   
   > 3_dXa:D+d/)9ZVACKYJI3Y~URN+nz?1esSmLi.V=1J`;GHv(uZHtzaJHoAE   
   > .DJ~}zDd{O*ApK{CE,$sb$$5e?:l]\J=~ddAj}WTL$$$$I#   
   >   
   >   
   > 2) Program to create an ASCII text program which can then be   
   > run to recreate a DOS binary program.   
   >   
   > to recreate the binary copy and paste to 'prog2.com' or somesuch then run   
   > prog2 >makeASCI.com   
   >   
   > usage is makeASCI dosprog.com > asciprog.txt   
   >   
   >   
   > 6h}aXP5y`P]4nP_XW(F4(F6(F=(FF)FH(FL(Fe(FR0FTs*}`A?+,   
   > fkOU):G*@Crv,*t$HU[rlf~#IubfRfXf(V#fj}fX4{PY$@fPfZsZsX1yDQH   
   > .+4WM4LVC4qsv9[T}ul-6JMbG_ZniNkBgUa,2bfa'Yfx0bVQzrj?($$f)_i   
   > EsLo$5KrLdORw$sklui$U[E+_ht`PdRBBfcgBgXFKY1uR6aty5oWwh(29nF   
   > fIa:r(QJ6h`g-L6$/2`J'pD\:lW:E;Ba5_x'oYoe9D\Q@9@2GS9@2G39@2F   
   > k9@2Fi9@2FR__9'lei+i\*JkJ'ne+yD'Y6WH1P'm-$a7nHl90uQ*ROVHj{?   
   > _`{)z*t0rLendO756$rgsRBM[r@8h?iVJpcR-GxxRsM.}w+Irs[zH[Kx5*8   
   > Xk@BNwxr0FLJzHZk,uKn@gFI:-n}0L.FLKm$bz)9\X_GDBnPNz?L(6oUxkD   
   > J9uI6m+tx2wVVJ=V\Kp?9N)}2yu.a=V]pBC-?XEG${TN46_yUJT$vg8cv,.   
   > ;\80s3W1ihCJmI_Hw.RtMd/o1HtC:TCcgXfPB8GDOZmqA:\@R4E*\[Je8?I   
   > b/}H?V0rL@bc4_`\$)[[d#   
   >   
   >   
   >   
   > when 'asciprog.txt' is copy and pasted to 'asciprog' and then run it will   
   > recreate 'dosprog' to STDOUT i.e.   
   >   
   > asciprog>dosprog.com   
   >   
   >   
   Seems I failed to xpost this back in mid-Feb.   
      
      
      
   I have since created a hex executer in a similar vein; it had a bug that's   
   taken me an embarrassing amount of time to track down. My program   
   worked fine under GRDB, (after stepping to ensure the fixedup code had   
   erm been fixedup), but went wrong with larger hex programs if executed   
   directly.   
   It turns out I was assuming that CX contains the length of the   
   executable (text) at start. This seems to not be the case, certainly on my   
   CMD box under XP - here it (CX) seems to be set to 0x00FF, so short   
   programs would decode OK, but larger ones truncated.   
      
   Does anyone here know if this is a known bug or is it something   
   peculiar to my setup? Is there any simple way to get the current   
   program's length (I'd prefer not to have to find my fn, then open and   
   search to end! ).   
      
   Any test report gratefully received in one of these forums; probably   
   c.o.m.p is best for relevance.   
      
   --   
   Bah, and indeed Humbug.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|