flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution
Code: test al,0xf |
|||
![]() |
|
pete
Oh gosh [am i dumb]. Thank you revolution!
By the way: this was just to test your skills, of course i already knew the answer. |
|||
![]() |
|
r22
pete, if you haven't already
spend some time with the Intel/AMD Instruction Set manuals and then the Optimization manuals they are very enlightening. This thread really highlights the fact that it takes a lot more effort to become competent in ASM then it does in an HLL. Code: //pete's original snippet in a HLL (without resorting to GOTO ln) //ironically/humorously it's less lines in ASM unsigned char savedByte = originalByte; originalByte <<= 4; originalByte >>= 4; if( originalByte == 0 ){ originalByte = savedByte; ... }else{ original = savedByte; ... } //rev's micro-snippet in a HLL if( originalByte & 0xf == 0 ){ ... } //what a novice/beginner might use in a HLL if( originalByte << 4 == 0 ){ ... } //or if ignorant of binary (&) and shift (<<) probably modulus if( originalByte % 16 == 0 ){ ... } Without full knowledge of an HLL you could muddle along and your ignorance would hardly be noticable to someone experienced in the language, BUT in ASM even the slightest lapse of knowledge can be glaringly obvious. Facinating realization, don't you think? |
|||
![]() |
|
windwakr
Ya, r22 is right. The manuals are very helpful. In case you don't know where to find them, heres the link.
I always have the instruction set manuals handy, to look through, to find what an instruction does, etc. I think you should start out by just going through the instruction set part of the "fasm.pdf" file, and then use the intel manuals once you are familiar with most of the instructions. |
|||
![]() |
|
bitRAKE
Code: aam 16 ![]() Four bits are called a nibble. ![]() |
|||
![]() |
|
revolution
bitRAKE wrote:
Code: shl al,4 |
|||
![]() |
|
Borsuc
Why not and al,15?
![]() |
|||
![]() |
|
revolution
Because the topic turned silly at the fourth post, so posting sensible suggestions like and al,15 is not expected.
![]() |
|||
![]() |
|
Borsuc
How about this then?
Code: mov bl, 0 mov cl, 4 @@: shr al, 1 adc bl, 0 loop @B ![]() |
|||
![]() |
|
pete
Aha, four bytes are called a nibble.
Your code is welcome, Borsuc ;) But why is it Code: mov cl,4 instead of Code: mov cl,1 shr cl,2 ??? Thanks for the link, windwakr! I already knew this site, stumbled across it some time but haven't used it yet; this will change! |
|||
![]() |
|
revolution
pete wrote: instead of Code: mov cl,1 shl cl,2 |
|||
![]() |
|
pete
Erm, yes...
|
|||
![]() |
|
DOS386
pete wrote: instead of Because shr cl,2 doesn't work on 8086 ![]() ![]() |
|||
![]() |
|
revolution
Well luckily no one has an 8086 (or an 8088) anymore. And anyone that does have one will find it doesn't work. And anyone that finds it does work will not any good use for it. And anyone that does have a good use for it is not living in the real world.
![]() |
|||
![]() |
|
Borsuc
What about using virtual machines for fooling around with a bad algo?
![]() |
|||
![]() |
|
Azu
pete wrote: Aha, four bytes are called a nibble. |
|||
![]() |
|
DOS386
> I thought half a byte is called a nibble? Aren't four bytes called a dword?
Sure, pete is wrong. 4 Bytes = DWORD = ?INT32 |
|||
![]() |
|
revolution
Depends upon the CPU, ARM call a 4 byte value a word.
![]() |
|||
![]() |
|
pal
A nibble (some people spell it nybble I think) is 4 bits. It is not half of a byte as a byte is not necissarily 8 bits. I.e. nibble = half of an octet.
There are other ones too. http://en.wikipedia.org/wiki/Byte wrote:
But it is not half a byte necissarily. |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.