Necessary Fundamentals / Hexadecimal/Octal/Binary
Subtitles of the Movie
The computer of course stores values as a string of bits, binary numbers. To understand the assembly language programs, to be able to read listings and debug the programs you need to understand boolean algebra, also known as the binary system. It works the same way as the system you're used to which has 10 digits, the binary system has only 2. But any integer value can be represented with just these two. Here are the first 16 numbers in base 10 and in binary. A couple of things are apparent from this sequence, first, in binary numbers all odd numbers have the lowest order bit set to 1. That fact comes in handy every now and then, also and more important, the first 16 numbers all fit inside 4 bits. A string of ones and zeros is hard to read so we've devised a code that can be used to represent a binary number. It's called hexadecimal, each hexadecimal digit represents 4 bits. The hexadecimal numbering system has 16 digits. It's nothing more than an easy to read form representing binary numbers. It's especially handy when you need to represent a number longer than 4 bits, for example this number is a little difficult to read without counting the bits to figure it out but the same number written as a pair of hexadecimal digits is much easier, with a little practice you can become almost as comfortable with hex as you are with base 10. The whole trick is to organize the bits into groups of 4 then assign a letter to each group. Another way to write this same value is with octal digits. It takes 3 digits to represent an 8 bit value. The first digit represents the first 2 bits and the other digits represent 3 bits each. That makes an 8 bit byte, you need to understand octal in case you ever come across it but it's mostly of historical interest these days, about the only thing it's still used for is the file formation system on Unix. This same number written in base 10 is 182. The problem comes up from time to time that you need to convert a number from one base to another, it doesn't happen often but it does happen. There are two approaches you can take, first let me convert a number from hex to base 10. This is the hexadecimal value 3C4, in base 10 each digit represents a power of 10 and in base 16, each digit represents a power of 16 so it can be converted with this expression, the value 256 is 16 squared and the value of C is 12, to convert it back the other way you divide these same numbers. The remainder of the division is important because you use it in the next step, the last remainder is divided by 16 to the power 0 which is 1. The result is the 3 digits in the result, 3, 12, and 4 which is written in hex digits as 3C4. The key to doing this sort of conversion is practice. If you want to get good at this make up some hex numbers and convert them from base 10 and then back. You won't have to do any of these conversions to understand this course, you may find yourself wanting to do some so you can better understand some of the things that you're going to see but it isn't required. Besides, there is a much better way if you find that you want to do this a lot you can do it the way I do it, I use a calculator. Today, even the cheap little calculators that have all the math functions on them also convert from one base to another.
Tutorial Information
| Course: | Assembly Language Programming |
| Author: | Arthur Griffith |
| SKU: | 33995 |
| ISBN: | 1-935320-44-0 |
| Release Date: | 2009-05-28 |
| Duration: | 5.5 hrs / 70 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 81,350 Video Tutorials (20,800 free)
- Video Available as Flash or QuickTime
- Over 782 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 