OpenCores
URL https://opencores.org/ocsvn/8051/8051/trunk

Subversion Repositories 8051

[/] [8051/] [trunk/] [asm/] [cast.c] - Blame information for rev 186

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 simont
/*
2
 * Copyright (c) 1999-2001 Tony Givargis.  Permission to copy is granted
3
 * provided that this header remains intact.  This software is provided
4
 * with no warranties.
5
 *
6
 * Version : 2.9
7
 */
8
 
9
/*---------------------------------------------------------------------------*/
10
 
11
#include <reg51.h>
12
 
13
/*---------------------------------------------------------------------------*/
14
 
15
unsigned char cast(unsigned long l) {
16
 
17
    return (unsigned char)l;
18
}
19
 
20
/*---------------------------------------------------------------------------*/
21
 
22
void main() {
23
 
24
    unsigned long l = 0x01234567;
25
 
26
    P0 = cast(l >> 24);
27
    P1 = cast(l >> 16);
28
    P2 = cast(l >>  8);
29
    P0 = cast(l >>  0);
30
 
31
    while(1);
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.