URL
https://opencores.org/ocsvn/8051/8051/trunk
[/] [8051/] [trunk/] [asm/] [divmul.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>
|
|
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
|
|
void main() {
|
void main() {
|
|
|
unsigned x = 134;
|
unsigned x = 134;
|
unsigned y = 1;
|
unsigned y = 1;
|
unsigned q, r, p, i;
|
unsigned q, r, p, i;
|
|
|
for(i=0; i<12; i++) {
|
for(i=0; i<12; i++) {
|
|
|
y++;
|
y++;
|
}
|
}
|
|
|
q = x / y;
|
q = x / y;
|
r = x % y;
|
r = x % y;
|
p = q * y + r;
|
p = q * y + r;
|
|
|
P0 = q;
|
P0 = q;
|
P0 = r;
|
P0 = r;
|
P0 = p;
|
P0 = p;
|
|
|
while(1);
|
while(1);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.