flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution 15 May 2009, 09:03
Code: test al,0xf |
|||
![]() |
|
pete 15 May 2009, 09:09
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 15 May 2009, 20:53
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 15 May 2009, 21:13
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 16 May 2009, 02:15
Code: aam 16 ![]() Four bits are called a nibble. ![]() |
|||
![]() |
|
revolution 16 May 2009, 09:48
bitRAKE wrote:
Code: shl al,4 |
|||
![]() |
|
Borsuc 16 May 2009, 19:40
Why not and al,15?
![]() |
|||
![]() |
|
revolution 16 May 2009, 19:45
Because the topic turned silly at the fourth post, so posting sensible suggestions like and al,15 is not expected.
![]() |
|||
![]() |
|
Borsuc 16 May 2009, 19:58
How about this then?
Code: mov bl, 0 mov cl, 4 @@: shr al, 1 adc bl, 0 loop @B ![]() |
|||
![]() |
|
pete 18 May 2009, 06:18
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 18 May 2009, 06:24
pete wrote: instead of Code: mov cl,1 shl cl,2 |
|||
![]() |
|
pete 18 May 2009, 06:28
Erm, yes...
|
|||
![]() |
|
DOS386 18 May 2009, 07:58
pete wrote: instead of Because shr cl,2 doesn't work on 8086 ![]() ![]() |
|||
![]() |
|
revolution 18 May 2009, 08:14
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 18 May 2009, 17:28
What about using virtual machines for fooling around with a bad algo?
![]() |
|||
![]() |
|
Azu 23 May 2009, 01:32
pete wrote: Aha, four bytes are called a nibble. |
|||
![]() |
|
DOS386 23 May 2009, 09:13
> 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 23 May 2009, 12:38
Depends upon the CPU, ARM call a 4 byte value a word.
![]() |
|||
![]() |
|
pal 23 May 2009, 13:47
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.