URL
https://opencores.org/ocsvn/8051/8051/trunk
[/] [8051/] [tags/] [rel0/] [asm/] [cast.c] - Diff between revs 185 and 186
Only display areas with differences |
Details |
Blame |
View Log
Rev 185 |
Rev 186 |
/*
|
/*
|
* Copyright (c) 1999-2001 Tony Givargis. Permission to copy is granted
|
* Copyright (c) 1999-2001 Tony Givargis. Permission to copy is granted
|
* provided that this header remains intact. This software is provided
|
* provided that this header remains intact. This software is provided
|
* with no warranties.
|
* with no warranties.
|
*
|
*
|
* Version : 2.9
|
* Version : 2.9
|
*/
|
*/
|
|
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
|
|
#include <reg51.h>
|
#include <reg51.h>
|
|
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
|
|
unsigned char cast(unsigned long l) {
|
unsigned char cast(unsigned long l) {
|
|
|
return (unsigned char)l;
|
return (unsigned char)l;
|
}
|
}
|
|
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
|
|
void main() {
|
void main() {
|
|
|
unsigned long l = 0x01234567;
|
unsigned long l = 0x01234567;
|
|
|
P0 = cast(l >> 24);
|
P0 = cast(l >> 24);
|
P1 = cast(l >> 16);
|
P1 = cast(l >> 16);
|
P2 = cast(l >> 8);
|
P2 = cast(l >> 8);
|
P0 = cast(l >> 0);
|
P0 = cast(l >> 0);
|
|
|
while(1);
|
while(1);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.