Binary
Blitz3D Forums/Blitz3D Beginners Area/Binary
| ||
You write hex numbers by prepending a dollar sign. eg. $1ab4. But how do you write binary numbers in Blitz? |
| ||
use % a=%1111 print a will print 15 |
| ||
% maybe? edit: i was beaten to the punch =] |
| ||
Thank you. Didn't find it in the manual. |
| ||
It should be in the manual somewhere. %1010 = 4 bits also known as a nibble %10101010 = 8 bits also known as a byte %1010101010101010 = 16 bits also known as a Word %10101010101010101010101010101010 = 32 bits also known as a LongWord Well, those are Amiga terms, but are still valid I suppose |
| ||
>Well, those are Amiga terms, but are still valid I suppose Almost right... They're Motorola terms! Andy |
| ||
%1010101010101010101010101010101010101010101010101010101010101010 = 64 bits aka ?? |
| ||
64bits aka doubleword. |
| ||
128bits aka quadword, hang on a minute, I made that up! quadword (c)2004 Shambler |
| ||
No ya didn't. :) Prior art! [link]http://help.phys.unsw.edu.au/doc/f77/14,160.html[/link] |
| ||
Remember The pentium has 16 64 bit registers called mmx registers and 8 128 bit registers. called xmm registers These are mainly used for video processing. Just thought it was worth mentioning here. |
| ||
Indeed it is worth mentioning. A byte is the addressable bitwidth the address bus - not the 8 bits that M$ insist. |
| ||
8 bits is a byte and acording to AMD the athlon has a 35bit memory buss and a 72bit bidirectional data buss (64bits data 8bits ECC) was it the ECC part of the buss you were refering too ?? 1 is a bit 4 is a nibble (mind i haven`t heard that used for a long long time) 8 is a byte 16 is a word 32 is a longword 64 bits is a Qword or INT64 (I only know this because Bass uses them for timecodes ;lol) is 32 bits still a refered too as a longword as well as an INT ? or has the terminology totally changed in that sense ? |
| ||
The term "byte" (meaning bite - of bitten) was originally a play on words (not much of one tho :/) and refers to the number of bits that can be processed per cycle at the processor. Naturally that depends on the bitwidth of the address bus. A nybble is half of one byte - not, as the younguns dogmatically insist, 4 bits. I have never heard of "QWord" but historically they are called "Double longword". (I assume Q is for quad) So, to sum up - if the addressable bitwidth is 8 bits then that is the measure of the byte. If the addressable bitwidth is 32 bits then that is the measure of the byte. An Int is an integer thru -32128 and 32127 |
| ||
Hi Folks, I think that the definition of a 'byte' is universally accepted as 8 bits. I'm going back 20 years in terms of computing experience and I can't say I remember anyone challenging it once in that whole time. Graythe, you may be 'technically' correct but that's not always what counts. Get your slippers,pipe and Werthers and get ready for the granny farmers to come get you. Later, Jes |
| ||
Naturally that depends on the bitwidth of the address bus Shouldn't that be the data bus? :) |
| ||
The Motorola 68060 (which is installed in my Amiga1200) used 32bits adressing and operates at 50MHz. I used a testprogram to determine how fast (x Mb/sec) my processor could transfer data. It showed me 200Mb/sec. The processor handles only 1 transfer per clockcycle. The processor transfers 32bits at once (= 4 bytes). And 4 bytes x 50MHz (50.000.000 transfers per second) = 200Mb/sec. So a byte MUST be 8 bits wide. |
| ||
Yeah I know that I was always taught that 8bits is a byte and that was by prefessor`s of computing at UNI and earlier by every book I read about microprocessors. 8 Bit`s is a byte , mind I don`t think any of them told me why 8bits was a byte and Greythe might be right from the initial inception point of view , but surley that can`t be true now as a 32bit wide buss is never refered to as a byte wide bus , nor is a 32bit value refered to as a byte value ,it`s always classed as four bytes or a Long. "An Int is an integer thru -32128 and 32127" thats misleading as that is a signed short int not an INT as accepted as the norm in C/C++ and as taught in a Degree course and accepted by the american national standards institue (as in ASCI C), this could get people new to programming confused. An INT (32bits/4bytes) is -2147483648 to 2147483647 A unsigned INT (32bits) is 0 to 4294967295 A SHORT INT (16bits/2bytes) is -32128 to 32127 A unsigned SHORT INT (16bit) is 0 to 65535 A Char (8bit/1byte) is -128 to 127 A unsigned Char (8bit/1byte also called an Octet) is 0 to 255 A Float is 32bits the same size as an INT but is a more complex in the way it works as it involves a mantesia value and exponent and sign to store fractions in binary that the IEEE (institute of electrical and electronic engineers) came up with and to be honest I have forgot how to work them out, but it`s along the lines that 24bits represent 0.0000000 to 0.999999 and the remaining 8bits are used to scale that number to the required value and sign , there`s an 64bit double presision float too. They are as defined in ansi and as far as I know are the universally accepted notations as I was taught at UNI. the 64bit 8byte Qword/INT64/Quad is a Double Long but in C I think it`s def is a Long Long / Qword ,or just INT64 and i`m pretty sure its INT64 in delphi. I never used them at uni as we never dealt with numbers that large, 0 to 18446744073709551615 unsigned and as far as i know they`re mainly used as timecodes for video and audio (like in the Bass library), and things like calculating planetary orbit and that sort of stuff, so I have only used them recently with bass2.0 in blitz3d, but had to trick the functions into thinking two INTs were the Qword the function was looking for, as blits only supports standard 32bit ints as far as I know (maybe one for an update ?). No offence meant to anyone and i`m not directly saying greythe is wrong, I just think it`s better (especially as this is in the beginners area) that the current accepted norms be shown to anyone new ,as older terminology or definitions might confuse them . |