2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
15 #pragma off (unreferenced)
16 static char rcsid[] = "$Id: coindev.c,v 1.1.1.1 2001-01-19 03:30:05 bradleyb Exp $";
17 #pragma on (unreferenced)
25 int CoinMechPort[3] = { COINMECH1_PORT,
29 int CoinMechCtrl[3] = { COINMECH1_CTRLMASK,
33 unsigned int CoinMechLastCnt[3];
36 int coindev_init(CoinMechNumber)
40 int CoinMechAdj[3] = { COINMECH1_ADJMASK,
44 /* set up IO port for our special use */
45 outp(COINMECH_CMDPORT, CoinMechCtrl[CoinMechNumber]);
46 outp(CoinMechPort[CoinMechNumber], 0);
47 outp(CoinMechPort[CoinMechNumber], 0);
49 /* write to the IO board so that the counter eventually gets cleared */
50 for( x = 10; x > 0; x-- )
52 outp(COINMECH_ADJPORT, CoinMechAdj[CoinMechNumber]);
53 outp(COINMECH_ADJPORT, 0);
54 if( coindev_read(CoinMechNumber) == 0 )
60 CoinMechLastCnt[CoinMechNumber] = 0;
62 return(x); /* TRUE == CoinMech is cleared; FALSE == CoinMech error! */
66 /* Do a raw read of the specified CoinMech */
67 unsigned int coindev_read(CoinMechNumber)
71 /* read lower byte, then upper byte */
72 x = (inp(CoinMechPort[CoinMechNumber]));
73 x += (inp(CoinMechPort[CoinMechNumber]) * 256);
75 /* conver to usable number */
85 /* read the specified CoinMech and return the */
86 /* ...number of clicks since the last read */
87 unsigned int coindev_count(CoinMechNumber)
91 x = coindev_read(CoinMechNumber);
92 y = x - CoinMechLastCnt[CoinMechNumber];
94 CoinMechLastCnt[CoinMechNumber] = x;