Re: delete bytes



Hi,
I use A86, but may be, i have to use nasm, we will speak same langage.
Regards
Almas

"Herbert Kleebauer" <klee@xxxxxxxxx> a écrit dans le message de news:
48159C6F.D038B360@xxxxxxxxxxxx
almas wrote:


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 :

I never found out whether your post are meant serious or if you
are just playing a game with us. Did you you really retype the
hex codes instead of a copy and paste? Here the code in NASM
syntax, assemble it with "nasm convert.asm -o convert.com".

But I really can't advise an assembler which gives an error when
using the label "loop". I think the "short" and "byte" are not
necessary, but the NASM disassembler put it there.


org $100

xor bp,bp ; clear flag

loop1: call getc ; get char from stdin
cmp ax,-1 ; EOF
jnz .10 ; branch if not
jmp exit ; exit program

.10: cmp al,$21
jc .20
cmp al,$2f
ja .20

test bp,bp
jnz loop1 ; not the first character $21-$2f
or bp,byte 1 ; set flag
jmp short .30

.20: xor bp,bp ; clear flag
.30: call putc ; write char to stdout
jmp short loop1

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

putc: pusha
mov ah,$40
mov dx,sp
add dx,byte 14
mov cx,1
mov bx,1
int $21
popa
ret

getc: xor ax,ax
pusha
mov ah,$3f
mov dx,sp
add dx,byte 14
mov cx,1
xor bx,bx
int $21
jc .10
cmp cx,ax
jnz .10
popa
ret
.10: popa
or ax,byte -1
ret

exit: mov ah,$4c
int $21

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


.



Relevant Pages

  • Re: which book to start with...?
    ... mov eax, 4 ... just installed nasm 16 bit and 32 bit bins under dosemu. ... .bss wont accept initialisations while .data will but no garantee for modification at runtime. ... Section .bss is nominally "uninitialized" data, but is in fact cleard to zero. ...
    (alt.lang.asm)
  • Re: Why is my nasm program killing itself?
    ... Nasm is like a sewer, Phil - what you get out of it depends on what you put in. ... If you pour source code suitable for a dos .com file into Nasm, you'll get a dos .com file out. ... orig equ $08048000 ... mov byte,49;working once ...
    (alt.lang.asm)
  • Re: newbie questions
    ... MOV AH,4EH; ... instruction operands must be the same size" this error is in line " INT 21H", because it points everything whats after mov dx, offset mask. ... X86 addresses *always* involve a segment register, ... The examples in your book will need some alteration to work with Nasm. ...
    (alt.lang.asm)
  • Re: 16/32 processor operating mode
    ... Looking back over your posts, you started out asking why we need to give a ".model" directive in Tasm, but not in Nasm. ... The most common case where you'd need to override the defaults would be making a 32-bit Windows file in "-f obj" mode. ... mov eax, cr0 ... "mov ax, bx" and "mov eax, ebx" are the same instruction. ...
    (alt.lang.asm)
  • Re: I this a program for permant delete of files in M$_DOS?
    ... mov ax, 40h; set ds to BIOS data area ... cmp si, 0 ...
    (alt.lang.asm)