Re: delete bytes



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