In general binary operation that 11111111(255)+00000001(1)=100000000(256)
The operation result will be 0 for 8 bit Adder, because the processor is 8 bits only.
If a processor support saturated arithmetic, 255+1 would be 255 (stop at max or min value), and it would not overflow or underflow.
Reference:
http://www.techbang.com/posts/10678-fully-understand-arm-processors-cisc-and-risc-are-what-history-structure-a-see-through-the-computer-96-issues-cover-story-the-king?page=2
Murmur of a rookie software engineer came from Taiwan.
(Sorry for my poor English, I just practice it here.)
Please feel free to contact me for anything: ninna.tw@gmail.com
2012年9月19日 星期三
2012年3月14日 星期三
LITTLE_ENDIAN and BIG_ENDIAN
The keywords LITTLE_ENDIAN and BIG_ENDIAN could specify store order in memory.
for some CPU:
If there is a two byte data in memory, Ex: long d=0x12345678
It would be store as the order as below table.
| big-endian | little-endian | |
0x0000
|
0x12
|
0x78
|
0x0001
|
0x34
|
0x56
|
0x0002
|
0x56
|
0x34
|
0x0003
|
0x78
|
0x12
|
What different ?
for some CPU:
- INTEL X86、DEC VAX use LITTLE-ENDIAN
- HP、IBM、MOTOROLA 68K use BIG-ENDIAN
- POWERPC support both,called BI-ENDIAN
2011年3月22日 星期二
Bitmap Format
Note how to read bitmap data
Reference from http://crazycat1130.pixnet.net/blog/post/1345538
-----------------------------
Bitmap File Header
0000h - 0001h : Identifier ('BM') [1]
0002h - 0005h : File Size (byte)
Annotations

Reference from http://crazycat1130.pixnet.net/blog/post/1345538
-----------------------------
Overview Bitmap Byte File
bitmap file make up of four parts
- Bitmap File Header
- Bitmap Info Header
- Color Table (Palette)
- Bitmap Array
All words was shown in little-endian mode.It's mean if value is 0x1234, you will look it display 0x3412.
example shown as a 8X8 pixels all fill red color bitmap file
Bitmap File Header
0000h - 0001h : Identifier ('BM') [1]
0002h - 0005h : File Size (byte)
0006h - 0009h : Reserved
000Ah - 000Dh : Bitmap Data Offset
Example:
0000 | 42 | Identifier BM 42H=66D='B' , 4DH=77D='M' |
0001 | 4D | |
0002 | F6 | because Little-Endian, so writing F6000000H File Size 246 byte F6H=246D Header 54 + Content 192 (8 X 8 X 3) = 246 |
0003 | 00 | |
0004 | 00 | |
0005 | 00 | |
0006 | 00 | Reserved |
0007 | 00 | |
0008 | 00 | |
0009 | 00 | |
36 | Bitmap Data Offset 54 byte It's also mean the size of file header | |
000B | 00 | |
00 | ||
000D | 00 |
Annotations
【1】This field includes verious code for identify type of bitmap:
'BM' - Windows 3.1x, 95, NT, ...
'BA' - OS/2 Bitmap Array
'CI' - OS/2 Color Icon
'CP' - OS/2 Color Pointer
'IC' - OS/2 Icon
'PT' - OS/2 Pointer
'BM' - Windows 3.1x, 95, NT, ...
'BA' - OS/2 Bitmap Array
'CI' - OS/2 Color Icon
'CP' - OS/2 Color Pointer
'IC' - OS/2 Icon
'PT' - OS/2 Pointer
to be continue...
訂閱:
文章 (Atom)