Hi Wolfgang , hello world.
Sure, at the last line "you are a comment"
But i did not found any instruction called Wolfgang :-)
Yes, i coult try to igore errors, so i can shutdown some bytes.
May be, i will do it, actualy i prefer that the COM file can detect errors
a run correctly
...... / ....
Now, i'm working on an other goal.
The aim is if i have two ascii
between 22h and 2Fh ( i can identify it )
and if the next ascii have same value, i remove it into "~"
Example : (( become ~ ~
but ( * stay (*
### become ~ ~ ~
I try .... and have troubles
If i put ##(*) i obtain ~##(**
or i have in others version ~ ~ ~*)
I fact the next byte keep the value of the byte before.
The next step : destroy all the ~
I spend a large part of saturday and obtain "funny" ; stranges results
"Wolfgang Kern" <nowhere@[EMAIL PROTECTED]
> a écrit dans le message de news:
fues69$4pc$1@[EMAIL PROTECTED]
>
> almas wrote:
>
>> Hi everybody hello world
>> Below, the solution of Wolfgang.... i again reduce the size of file.
>> now
>> 55 bytes.
>>
>> Regards Almas
>>
>> mov si,0082h ;;;;;; mov esi,0082h ; I assume space before parameters
>> ; cmp byte [esi-2],0 ; a few buyes more, but perhaps useful
>> ; jz error ;if commandline is empty
>> lodsw ;get both bytes at once
>> call convert ;modify AL set carry/NC on error/GOOD
>> jc error
>> shl al,4
>> xchg al,ah ;save first and use second yet
>> call convert ;call the same again
>> jc error
>> or al,ah
>> mov offset hexa,AL
>> ; jmp short error ; display_quit
>>
>> error:
>> mov dx, offset errtxt ; jmp short error_quit
>> ; ;;;;;;; display_quit: ; mov dx, offset txt
>> error_quit:
>> mov AH,09
>> int 21h
>> ;;;;;; ret ;it will work, even I'd always use:
>> ;;;;;; The RET of the call will be used like an INT 20h
>> ;;;;; If it go in convert routine, the only output is RET
>
> Ok, even this is a rare seen method for saving on one byte :)
> always comment things like this in deep detail for yourself
> in case you may look at it again after some years.
>
>> convert:
>> ; cmp al,30h ;I'd put this in ; jc oh_no ;jc == jb
>> cmp al,3ah
>> jc num
>> cmp al,41h
>> jc oh_no
>> cmp al,47h ;
>> cmc ;invert the carry-bit (error if NoCarry >46h)
>> jc oh_no
>> sub al,07h
>> num:
>> sub al,30h
>> oh_no:
>> ret ;the last SUB will always result in NoCarry
>> ;while any error got a set Carry-flag now.
>
> Because you ignore input <30h anyway, you could
> shorten 'convert' and ignore 'all' wrong input
>
> convert:
> sub AL,30h
> cmp AL,0Ah
> jc done
> sub AL,07h
> done:
> ret
>
> and then you must also remove the 'jc error' lines after
> the two CALLs (saved four more bytes).
>
>> ; mov ax,4c00h ;because DOS will restore its stack and
>> ; int21h ;segment-registers on termination then.
>>
>> errtxt db: "A2H" ,9 ; information about usage here
>>
>> ; txt db: " "
>> hexa db: " " ,36 ; old value ,10,36
>> ; wolfgang
>
> Oh, I became out-commented :)
> __
> wolfgang
>
>
>


|