Re: delete bytes



almas wrote:

Hi everybody.

Yesterday, i try with files above 64K. file.out have a size of 49K ; but i
just have 15Kbytes correct

This morning, i try with small siez file.
Supprise, the input becomes with a larger size
And output is also at 49Kb

I can change an indesirable byte into an other ( for example 00h becomes
2Ah )
And i can remove the 2Ah [ * ] with a tool like srep.com
So i will use this way.

I know you don't like any advice, but I will try it once more:

As a start, forget about doing the file handling yourself. Just
use stdin and stdout for in/output. This way you can handle
long filenames (and filename with spaces) and a file size
up to 2 Gbyte. So make three subroutines (getc, putc and exit)
which you can reuse in many programs. Your main program is
then nothing more than a dozen lines (the complete binary has
89 bytes).

Usage: convert.com <infile.txt >outfile.txt

@=$100

0100: 31 ed eor.w r4,r4 ; clear flag

0102: e8 0032 loop: bsr.w getc ; get char from stdin
0105: 3d ffff cmp.w #-1,r0 ; EOF
0108: 75 03 bne.b _10 ; branch if not
010a: e9 0048 br.w exit ; exit program

010d: 3c 21 _10: cmp.b #$21,r0
010f: 72 0d blo.b _20
0111: 3c 2f cmp.b #$2f,r0
0113: 77 09 bhi.b _20

0115: 85 ed tst.w r4,r4
0117: 75 e9 bne.b loop ; not the first character $21-$2f
0119: 83 cd 01 orq.w #1,r4 ; set flag
011c: eb 02 br.b _30

011e: 31 ed _20: eor.w r4,r4 ; clear flag
0120: e8 0002 _30: bsr.w putc ; write char to stdout
0123: eb dd br.b loop

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0125: 60 putc: movem.w r0-r7,-(sp)
0126: b4 40 move.b #$40,m0
0128: 89 e2 move.w r7,r1
012a: 83 c2 0e addq.w #14,r1
012d: b9 0001 move.w #1,r2
0130: bb 0001 move.w #1,r3
0133: cd 21 trap #$21
0135: 61 movem.w (sp)+,r0-r7
0136: c3 rts.w

0137: 31 c0 getc: eor.w r0,r0
0139: 60 movem.w r0-r7,-(sp)
013a: b4 3f move.b #$3f,m0
013c: 89 e2 move.w r7,r1
013e: 83 c2 0e addq.w #14,r1
0141: b9 0001 move.w #1,r2
0144: 31 db eor.w r3,r3
0146: cd 21 trap #$21
0148: 72 06 bcs.b _10
014a: 39 c1 cmp.w r0,r2
014c: 75 02 bne.b _10
014e: 61 movem.w (sp)+,r0-r7
014f: c3 rts.w
0150: 61 _10: movem.w (sp)+,r0-r7
0151: 83 c8 ff orq.w #-1,r0
0154: c3 rts.w

0155: b4 4c exit: move.b #$4c,m0
0157: cd 21 trap #$21

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.



Relevant Pages

  • Re: [Question:]How to split one file into 3/4 using fortran?
    ... > If I wrote one it would be in AWK. ... SUBROUTINEs with no dummies and thus no paren but trailing spaces. ... in Fortran identifiers, while the underlying OS might ... identifiers longer than are allowed for filenames. ...
    (comp.lang.fortran)
  • Re: delete bytes
    ... Is my modification correct? ... use stdin and stdout for in/output. ... long filenames and a file size ... up to 2 Gbyte. ...
    (alt.lang.asm)