Re: delete bytes



Hi Herbert.
Hi everybody.

I make a com file with your part of code.
When i put ">" i change the value
I made the file bytes, after bytes....
then i do dis file.com.... and obtain below :

100 31 ed xor bp,bp
102 e8 32 00 call 0137 > call 136 ?

105 3d ff ff cmp ax,ffff
108 75 03 jnz 010d
10a e9 48 00 jmp 0155 > jmp 153 ?

10d 3c 21 cmp al,21
10f 72 0d jb 011e
111 3c 2f cmp al,2f
113 77 09 ja 011e
115 85 ed test bp,bp
117 75 09 jnz 0122 > jnz 120 ?
119 83 cd 01 or bp,01
11c eb 02 jmp 0120

11e 31 ed xor bp,bp

120 e8 02 00 call 0125
123 eb dd jmp 0102

125 60 pusha
126 b4 40 mov ah,40
128 89 e2 mov dx,sp
12a 83 c2 0e add dx,0e
12d b9 01 00 mov cx,0001 > just 1 byte ?
130 bb 01 00 mov bx,0001
133 cd 21 int 21
135 c3 ret

136 31 c0 xor ax,ax
138 60 pusha
139 b4 3f mov ah,3f
13b 89 e2 mov dx,sp
13d 83 c2 0e add dx,0e
140 b9 01 00 mov cx,0001
143 31 db xor bx,bx
145 cd 21 int 21
147 72 06 jb 014f

149 39 01 cmp [bx+di],ax
14b 75 02 jnz 014f
14d 61 popa
14e c3 ret

14f 83 c8 ff or ax,-01
152 c3 ret

153 b4 4c mov ah,4c
155 cd 21 int 21

Is my modification correct ?
I did not try the code, but i will

Regards
Almas


"Herbert Kleebauer" <klee@xxxxxxxxx> a écrit dans le message de news:
4811A89E.733FA577@xxxxxxxxxxxx
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


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


.