Re: delete bytes
- From: Herbert Kleebauer <klee@xxxxxxxxx>
- Date: Mon, 28 Apr 2008 18:32:51 +0200
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.
- References:
- delete bytes
- From: almas
- Re: delete bytes
- From: almas
- Re: delete bytes
- From: Rod Pemberton
- Re: delete bytes
- From: almas
- Re: delete bytes
- From: Herbert Kleebauer
- Re: delete bytes
- From: almas
- Re: delete bytes
- From: Herbert Kleebauer
- Re: delete bytes
- From: almas
- delete bytes
- Prev by Date: Re: delete bytes
- Next by Date: Re: Algorithms In Assembly Language
- Previous by thread: Re: delete bytes
- Next by thread: PT_NOTE section in the ELF header
- Index(es):
Relevant Pages
|