Re: delete "0D"
- From: "J.Dorval" <J.orval@xxxxxxxxxx>
- Date: Fri, 22 Aug 2008 23:26:04 +0200
"Dirk Wolfgang Glomp" <dirk@xxxxxxxxxxxxxxxxxxx> a écrit dans le message de
news: 1j16eimzxzhq$.11tsnlqksomiu$.dlg@xxxxxxxxxxxxx
Am Thu, 21 Aug 2008 20:04:28 +0200 schrieb J.Dorval:
Hello,
does exist a tool destroy bytes value "0D" in a file ?
I did not found it with google.
My first example is limited for files up to 64kb:
CODE SEGMENT use16 'CODE'
assume cs:CODE,ds:DATEN,ss:STAPEL
org 100h
START: mov ax, DATEN
mov ds, ax
mov bx, ss
mov ax, es
sub bx, ax
mov ax, sp
add ax, 0Fh
shr ax, 4
add bx, ax
mov ah, 4Ah
int 21h
mov bx, 1000h ; 64 KB
mov ah, 48h
int 21h
jc NOSPACE
mov FILSEG, ax
mov fs, ax
;--------------------------
mov ah, 62h ; Get the segment of the PSP,
int 21h ; maybe we start as a child process.
mov ds, bx
mov es, bx
mov di, 80h
mov cl, [di]
cmp cl, 2
jna NOPARA
cld
inc di
mov al, 20h
repe scasb
dec di
mov bp, di
SUCHCR: cmp BYTE PTR[di], 0Dh ; end of filename
jz short FOUND
inc di
jmp SUCHCR
;--------------------------
FOUND: mov WORD PTR[di], 2400h ; 0,"$" behind the filename
mov ax, fs
mov cx, es
mov fs, cx
mov es, ax
mov dx, bp
mov ax, 3D02h
int 21h
jc NOFILE
mov bx, ax
mov ax, DATEN
mov ds, ax
xor dx, dx
xor cx, cx
mov ax, 4202h
int 21h
and dx, dx
jnz TOBIG
mov FILEN, ax
mov dx, 1
xor cx, cx
mov ax, 4200h
int 21h
xor dx, dx
xor cx, cx
mov ax, 4200h
int 21h
mov cx, FILEN
mov ds, FILSEG
mov ah, 3Fh
int 21h
mov cx, ax
mov ah, 3Eh
int 21h
;--------------------------
mov ax, DATEN
mov ds, ax
xor si, si
mov FILEN, cx
SUCHE: cmp si, cx
ja short ZMA
cmp BYTE PTR es:[si], 0Dh
jz short SCHR
inc si
jmp short SUCHE
;--------------------------
SCHR: dec WORD PTR[FILEN]
sub cx, si
mov di, si
inc si
mov ds, FILSEG
dec cx
mov dx, si
rep movsb
mov ax, DATEN
mov ds, ax
mov si, dx
mov cx, FILEN
jmp short SUCHE
;------------------------------------
ZMA: mov ax, fs
mov dx, 82h
xor cx, cx
mov ds, ax
mov ah, 3Ch
int 21h
mov bx, ax
mov ax, DATEN
mov ds, ax
xor dx, dx
mov cx, FILEN
mov ds, FILSEG
mov ah, 40h
int 21h
;--------------------------
NBACK: mov ah, 3Eh
int 21h
BACKE: mov ax, 4C00h
int 21h
;------------------------------------------
NOSPACE: mov dx, OFFSET ERRTEXT
mov ah, 9
int 21h
jmp short BACKE
;--------------------------
NOPARA: mov ax, DATEN
mov ds, ax
mov dx, OFFSET PARERR
mov ah, 9
int 21h
jmp short BACKE
;--------------------------
NOFILE: mov ax, DATEN
mov ds, ax
mov dx, OFFSET FILERR
mov ah, 9
int 21h
mov ax, fs
mov ds, ax
mov dx, bp
mov ah, 9
int 21h
jmp short BACKE
;--------------------------
TOBIG: mov dx, OFFSET BIGERR
mov ah, 9
int 21h
jmp short NBACK
CODE ends
;--------------------------------------------
DATEN SEGMENT use32 'DATA'
FILSEG DW 0FFFFh
FILEN DW 0FFFFh
FILERR DB 0Dh, 0Ah
DB "ERROR! File not found$"
PARERR DB 0Dh, 0Ah
DB "ERROR! Please specify a filename$"
ERRTEXT DB 0Dh, 0Ah
DB "ERROR! No workspace found$"
BIGERR DB 0Dh, 0Ah
DB "ERROR! File is to big$"
DATEN ends
;--------------------------
STAPEL SEGMENT use16 STACK 'STACK'
DB 20h dup (0FFh)
STAPEL ends
end
;--------------------------
Dirk
Hi Dirk,
did you use nasm ?
; i try " nasm input.asm -f bin -o output.bin "
i have error messages
.
- Follow-Ups:
- Re: delete "0D"
- From: Dirk Wolfgang Glomp
- Re: delete "0D"
- References:
- delete "0D"
- From: J.Dorval
- Re: delete "0D"
- From: Dirk Wolfgang Glomp
- delete "0D"
- Prev by Date: Re: Alexei fixes for NASM w/Borland TD
- Next by Date: Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- Previous by thread: Re: delete "0D"
- Next by thread: Re: delete "0D"
- Index(es):
Relevant Pages
|