Re: delete bytes



almas wrote:

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

Ok, here a a86 version (what a shame, a86 also doesn't allow a label "loop"):


org 100h

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,21h
jc .20
cmp al,2fh
ja .20

test bp,bp
jnz loop1 ; not the first character $21-$2f
or bp, 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,40h
mov dx,sp
add dx,14
mov cx,1
mov bx,1
int 21h
popa
ret

getc: xor ax,ax
pusha
mov ah,3fh
mov dx,sp
add dx,14
mov cx,1
xor bx,bx
int 21h
jc _10
cmp cx,ax
jnz _10
popa
ret
_10: popa
or ax,-1
ret

exit: mov ah,04ch
int 21h

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



Relevant Pages

  • Re: All is right !
    ... then i do again XOR 20h.... ... The byte falls at the location hexa... ... cmp al,41h jb error ... then a mov AH,0 would do it. ...
    (alt.lang.asm)
  • ANSWERS
    ... get code segment mov ds,ax; ... pointer usage text jmp errout; ... wanna clean registers xor ebx,ebx xor ecx,ecx xor edx,edx; ... get command line dump: lodsb cmp al,0; ...
    (alt.lang.asm)
  • Re: Hashing
    ... > mov ecx,eax ... > xor ebx,ebx ... > shl ebx,16 ... > shr eax,11 ...
    (alt.lang.asm)
  • Re: Hashing
    ... push ebx ... mov ecx,eax ... xor ebx,ebx ... Its a hash function quality ...
    (alt.lang.asm)
  • Re: Fastcode : function wont work with length>65535 ?
    ... push ebx ... mov edi,edx ... xor ebx,ebx ... shr ecx,2 ...
    (borland.public.delphi.language.basm)