home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CBM Funet Archive
/
cbm-funet-archive-2003.iso
/
cbm
/
firmware
/
drives
/
new
/
1551
/
1551.251641-3.c
< prev
next >
Wrap
C/C++ Source or Header
|
2003-06-08
|
2KB
|
94 lines
/** pROGRAM TO CONVERT LOGIC EQUATIONS
* OF 16 INPUTS AND 8 OUTPUTS
* TO A 64-KILOBYTE TRUTH TABLE.
* @AUTHOR mARKO m{$e4}KEL{$e4} (MSMAKELA@NIC.FUNET.FI)
* @DATE 8TH jULY 2003, BASED ON A VERSION FROM 2ND jULY 2002
* tHE EQUATIONS IN THIS PROGRAM HAVE BEEN TRANSLATED FROM THE
* machxl DESIGN DESCRIPTION SUPPLIED BY jENS sCH{$f6}NFELD (JENS@AMI.GA),
* AND VERIFIED AGAINST THE 64-KILOBYTE DUMPS SUPPLIED BY jENS sCH{$f6}NFELD.
*
* cOMPILATION:
*CC -O PLA 251641-3.C
* eXAMPLE USAGE:
*./PLA {$7c} DIFF - PLA-DUMP.BIN
* OR
*./PLA > PLA-DUMP.BIN
*/
#INCLUDE <STDIO.H>
/** eXTRACT AN INPUT BIT
* @PARAM BTHE BIT TO BE EXTRACTED
* @RETURNNONZERO IF THE INPUT BIT B IS SET
*/
#DEFINE i(B) (!!((I) & (1 << B)))
/** @NAME tHE INPUT SIGNALS.
* tHIS MAPPING CORRESPONDS TO THE 82s100 TO 27512 ADAPTER MADE BY
* jENS sCH{$f6}NFELD (JENS@AMI.GA). nOTE ALSO THE PERMUTATION OF OUTPUTS
* IN THE MAIN LOOP.
*/
/*@{$7b}*/
#DEFINE i0i(1)
#DEFINE i1i(2)
#DEFINE i2i(3)
#DEFINE i3i(4)
#DEFINE i4i(5)
#DEFINE i5i(6)
#DEFINE i6i(7)
#DEFINE i7i(12)
#DEFINE i8i(14)
#DEFINE i9i(13)
#DEFINE i10i(8)
#DEFINE i11i(9)
#DEFINE i12i(11)
#DEFINE i13i(15)
#DEFINE i14i(10)
#DEFINE i15i(0)
/*@{$7d}*/
/** @NAME tHE OUTPUT SIGNALS. */
/*@{$7b}*/
#DEFINE f0 !((!i15&&i0&&i1&&i2&&i3&&i4&&i5&&i6&&\
i11&&i14&&!i12&&!i7&&i9&&!i8&&i13){$7c}{$7c}\
(i15&&i0&&i1&&i2&&i3&&i4&&i5&&i6&&\
i11&&i14&&!i12&&!i7&&i9&&i8&&i13))
#DEFINE f1 i0&&i6&&!i7
#DEFINE f2 0
#DEFINE f3 0
#DEFINE f4 0
#DEFINE f5 0
#DEFINE f6 0
#DEFINE f7 i10{$7c}{$7c}(!i10&&i6&&i0&&!i7)
/*@{$7d}*/
/** tHE MAIN PROGRAM
* @PARAM ARGCCOMMAND LINE ARGUMENT COUNT
* @PARAM ARGVCOMMAND LINE ARGUMENT VECTOR
* @RETURNZERO ON SUCCESSFUL TERMINATION
*/
INT
MAIN (INT ARGC, CHAR** ARGV)
{$7b}
/** tHE INPUT COMBINATION, AT LEAST 16 BITS */
REGISTER UNSIGNED INT I = 0;
DO {$7b}
/** tHE OUTPUT COMBINATION, 8 BITS */
REGISTER UNSIGNED CHAR O = 0;
/* tHE OUTPUTS ARE PERMUTED SO THAT THEY CORRESPOND TO THE ADAPTER
* MADE BY jENS sCH{$f6}NFELD.
*/
IF (f0) O {$7c}= 1 << 6;
IF (f1) O {$7c}= 1 << 5;
IF (f2) O {$7c}= 1 << 4;
IF (f3) O {$7c}= 1 << 3;
IF (f4) O {$7c}= 1 << 2;
IF (f5) O {$7c}= 1 << 1;
IF (f6) O {$7c}= 1 << 0;
IF (f7) O {$7c}= 1 << 7;
PUTCHAR (O);
{$7d}
WHILE (++I & 0XFFFF);
RETURN 0;
{$7d}