Prev: Apple II Debugger
Next: TMA Assembler?
From: ArarghMail608NOSPAM on 25 Aug 2006 13:24 On Fri, 25 Aug 2006 16:21:51 GMT, Allen Egerton <aegerton(a)pobox.com> wrote: <snip> > >The leftmost columns in binary notation contain greater values than the >rightmost, just as in every other numeric based scheme. When counting, >you increase the column to its max value, then set it to zero and >increment the column to its left by one. > > >Here's a very small example: >Decimal Binary Octal Hex > 0 0000 0 0 > 1 0001 1 1 > 2 0010 2 2 > 3 0011 3 3 > 4 0100 4 4 > 5 0101 5 5 > 6 0110 6 6 > 7 0111 7 7 > 8 1000 10 8 > 9 1001 11 9 > 10 1010 12 A > 11 1011 13 B ^^^ added >And the neat thing about the relationship between octal and binary is >that each grouping of three binary bits represent an octal column. And the neat thing about the relationship between hex and binary is that each grouping of four binary bits represent an hex column. :-) Couldn't resist. :-) -- ArarghMail608 at [drop the 'http://www.' from ->] http://www.arargh.com BCET Basic Compiler Page: http://www.arargh.com/basic/index.html To reply by email, remove the garbage from the reply address.
From: Robert Redelmeier on 25 Aug 2006 13:46 In alt.lang.asm "?a\\/b" <al(a)f.g> wrote in part: > there is only one *good* way to rapresent numbers in a computer > 0 0 > 1 1 > 2 01 > 3 11 > 4 001 > 5 101 > etc Nonsense! There are many different ways to represent numbers in computers (binary, floats, BCD, ASCII and more). Each have their uses, depending on what will be done with the numbers. -- Robert
From: Allen Egerton on 25 Aug 2006 14:08 ArarghMail608NOSPAM(a)NOT.AT.Arargh.com wrote: <snip> >> Here's a very small example: >> Decimal Binary Octal Hex >> 0 0000 0 0 >> 1 0001 1 1 >> 2 0010 2 2 >> 3 0011 3 3 >> 4 0100 4 4 >> 5 0101 5 5 >> 6 0110 6 6 >> 7 0111 7 7 >> 8 1000 10 8 >> 9 1001 11 9 >> 10 1010 12 A >> 11 1011 13 B > ^^^ added > >> And the neat thing about the relationship between octal and binary is >> that each grouping of three binary bits represent an octal column. > > And the neat thing about the relationship between hex and binary is > that each grouping of four binary bits represent an hex column. :-) > > > Couldn't resist. :-) Appreciate the addition. (bad pun, sorry). I'm biased/pre-disposed to using octal as an alternative base due simply to the OS's I worked with originally. I can do hex, but it doesn't flow very naturally for me. -- Allen
From: ArarghMail608NOSPAM on 25 Aug 2006 15:41 On Fri, 25 Aug 2006 18:08:36 GMT, Allen Egerton <aegerton(a)pobox.com> wrote: >ArarghMail608NOSPAM(a)NOT.AT.Arargh.com wrote: ><snip> >>> Here's a very small example: >>> Decimal Binary Octal Hex >>> 0 0000 0 0 >>> 1 0001 1 1 >>> 2 0010 2 2 >>> 3 0011 3 3 >>> 4 0100 4 4 >>> 5 0101 5 5 >>> 6 0110 6 6 >>> 7 0111 7 7 >>> 8 1000 10 8 >>> 9 1001 11 9 >>> 10 1010 12 A >>> 11 1011 13 B >> ^^^ added >> >>> And the neat thing about the relationship between octal and binary is >>> that each grouping of three binary bits represent an octal column. >> >> And the neat thing about the relationship between hex and binary is >> that each grouping of four binary bits represent an hex column. :-) >> >> >> Couldn't resist. :-) > >Appreciate the addition. (bad pun, sorry). > >I'm biased/pre-disposed to using octal as an alternative base due simply >to the OS's I worked with originally. I can do hex, but it doesn't flow >very naturally for me. Well, I started on a 1401 -- a decimal machine. Then SYS360s -- hex, and finally a mini (a Nova) - octal. I tend to use which ever fits the current need. -- ArarghMail608 at [drop the 'http://www.' from ->] http://www.arargh.com BCET Basic Compiler Page: http://www.arargh.com/basic/index.html To reply by email, remove the garbage from the reply address.
From: Jim Carlock on 25 Aug 2006 16:00
Skybuck wrote some stuff about times: "f0dder" <f0dder.nospam(a)flork.dk.invalid> wrote: > *snip* > You use some pretty nonstandard way of measuring performance. > The normal is to decide a number of times to call each routine, > then measure how long it takes (usually in clock cycles, though > miliseconds is okay for a large number of calls). Did he actually post his timing algorithm? I agree, normally bigger numbers indicate greater amounts of time taken. Another method involves ORing instead of BTSing... xor edx, edx ; edx is used as result variable BT eax, 7 ; test bit 7 jnc skip7 ; if bit 7 = 0 goto skip7, else set bit0 = 1 OR EDX, 1 skip7: BT eax, 6 ; test bit 6 jnc skip6 ; if bit 6 = 0 goto skip6, else set bit1 = 1 OR EDX, 2 skip6: BT eax, 5 ; test bit 5 jnc skip5 ; if bit5 = 0 goto skip5, else set bit2 = 1 OR EDX, 4 skip5: BT eax, 4 ; test bit 4 jnc skip4 ; if bit4 = 0 goto skip4, else bit3 = 1 OR EDX, 8 skip4: BT eax, 3 ; test bit 3 jnc skip3 ; if bit3 = 0 goto skip3, else set bit4 = 1 OR EDX, 16 skip3: BT eax, 2 ; test bit 2 jnc skip2 ; if bit2 = 0 goto skip2, else set bit5 = 1 OR EDX 32 skip2: BT eax, 1 ; test bit 1 jnc skip1 ; if bit1 = 0 goto skip1, else set bit6 = 1 OR EDX, 64 skip1: BT eax, 0 ; test bit 0 jnc skip0 ; if bit0 = 0 goto skip0, else set bit7 = 1 OR EDX, 128 skip0: mov eax, edx ; output edx to eax the result end; And finally another version (air code, untested)... proc ReverseBits ; eax holds the input/output ; ecx gets the current bit to test/set ; edx gets input mov eax, edx xor eax, eax mov ecx, DWORD 0x128h ;start with high bit LOOP: ; make sure ecx doesn't equal 0 jecxz EXIT_LOOP BT eax, ecx jnc NO_SET_BIT OR eax, ecx NO_SET_BIT: SHR ecx, 1 jmp LOOP EXIT_LOOP: ReverseBits endp -- Jim Carlock Post replies to the group. |